Need to traverse

Hi,

i am loading a DB table in form using the connector, i want traverse previous and next record in the table…

the table consist of only name and age i want to load the table and i want to traverse to first record and has to traverse record one by one (next , previous)

some one tell me how to do it…

Hello,

Here is a demo
dhtmlx.com/docs/products/dhtmlxF … _load.html

Hi,

Thank u…

but

  i already know this type of loading a specific data using id 
  but i am having the database table without a id (i.e assume only name, age, department)

  in that two buttons previous and next, when i load the entire table the last record in the table is displayed in the form so i want to move previous and next record through the form......

Hi

Form keeps only one “row” of data loaded into it. It does not have internal iterator, so you need to add it manualy. Add events to you button and handle your rows.

If you loading all data at once, maybe then you need a bit different approach, like this:

var myData; dhtmlxAjax.get("load_my_data.php",function(r){ // parse response here // assume after this myData will looks like this: myData = [{name:"John",age:"30"},{name:"James",age:"35"},{name:"Diana",age:"28"},{name:"Rita",age:"32"}] initForm(); });
This will give you data on client side stored in one place.

Then init your form:

var myForm; var dataInd = 0; // current loaded data index function initForm(){ myForm = new dhtmlXForm("parentContainer",[ {type:"input", name:"name"...}, {type:"input", name:"age"...}, {type:"block", list:[ {type:"button", name:"prev"...}, {type:"newcolumn"}, {type:"button", name:"next"...} ]} updateFormData(); ]); myForm.attachEvent("onButtonClick",doOnFormButtonClick); }

And handle button clicks:

function doOnFormButtonClick(name) { if (name == "prev") { dataInd--; if (dataInd < 0) dataInd = myData.length-1; // loop updateFormData(); return; } if (name == "next") { dataInd++; if (dataInd >= myData.length) dataInd = 0; // loop updateFormData(); return; } } updateFormData() { myForm.setFormData(myData[dataInd]); }

i don’t know how to parse the data and put the data in dataInd variable

i don’t know what to be done at this area…
myData = [{name:“John”,age:“30”},{name:“James”,age:“35”},{name:“Diana”,age:“28”},{name:“Rita”,age:“32”}]

some one tell me how to do

on this step you need to parse your server response
in suggested demo I assumed that after parsing response myData variable become:
myData = [{name:“John”,age:“30”},{name:“James”,age:“35”},{name:“Diana”,age:“28”},{name:“Rita”,age:“32”}]

I can’t understand what u told,

tell me any easy way to do the traversing is there any API available for that functionality in DHTMLX

Hi

please check attached demo
demo.zip (44.4 KB)

Hi,

i am not loading a xml or a json file in to the form i am using the connector and dataprocessor to connect the server side data to the client side form in that i want to perform the traverse (previous record , next record), the connector generates the xml file and i am loading it using form.load help me if u can sample code as below

formData = [
{ type:“input” , name:“NAME”, label:“Name”, position:"" },
{ type:“calendar” , name:“DOB”, label:“dhxCalendar”, dateFormat:"%Y-%m-%d", serverDateFormat: “%Y-%m-%d”, readonly: true, position:"" },
{ type:“calendar” , name:“DOJ”, label:“dhxCalendar”, dateFormat:"%Y-%m-%d", serverDateFormat: “%Y-%m-%d”, readonly: true, position:"" },
{ type:“button” , name:“add”, value:“Add”, position:"" },
{ type:“button” , name:“save”, value:“Save”, position:"" },
{ type:“button” , name:“prev”, value:“Prev”, position:"" },
{ type:“button” , name:“next”, value:“Next”, position:"" }
];

		var myForm = new dhtmlXForm("box",formData);
		
		myForm.load('CheckForm.do');
		
		
		var mydp = new dataProcessor ("CheckForm.do");
		mydp.init(myForm);
		
		
		myForm.attachEvent("onButtonClick", function(id){
			if(id=="save"){
				myForm.save();
				alert("saved");
			}
			
			else if(id=="add"){
				myForm.clear();
			}
			else if(id=="next"){
			
			}
			else if(id=="prev"){
				
			}
	    });

then you can use:

myForm.load(…);

but you need to pass some id to define what data to load
but previously you told you not using ids

is there is any idea to traverse with out using any id…