Dynamic Loading count startPos not adding to url

Greetings!

Regret I could not find what I need by searching.
Using Pro version 2.5 (expect to upgrade someday :slight_smile: )

I am working on dynaminc loading, and have it enabled and my grid.loadXML(urlstring) calls the server just fine.

I am not using php, but using a call through cgi-bin. Problem is startPos=0&count=100 are not being appended to my url string.

var oereq = “http://localhost/cgi-bin/oecgi/inet_dce”;
var mtype = ‘a’;
var username = ‘paxton’;
mygrid.enableSmartRendering(true,100);
mygrid.loadXML(oereq+"?ACTION_CODE=LIBRARY&username="+username+"&mtype="+mtype);

I expected to find startPos=0&count=100 appended to the string, but they are not.
(I can do it myself to insure the xml is good, and it loads the first page)
I return proper xml with the total_count and count in the tags.

Any guidance to help me get startPos and count to be appended is appreciated.
Great stuff!
Have fun,
Paxton

This is expected behavior. Additional parameters is sent to server side only for automatic requests (e.g. when you scroll down in dynamic smart rendering mode). Try to replace your code like that:

var url = 'some.com/some'; mygrid.loadXML(url+"posStart=0&count=100"); mygrid.xmlFileUrl = url;

Olga,
Thanks for your help.

I followed your instructions, sending the startPos=0 and count=50 on the first request and the first 50 rows loaded fine. I set myAgrid.xmlFileUrl = url; (where url is the string used in the initial load without the startPos and count) as instructed. Nothing happened when I moved the slider on the grid, so I added myAgrid.attachEvent(“onDynXLS”,dynStart);
and put an alert in the dynStart function and found it was not firing.
Smart rendering is working, my grid is about 20 rows, and the first count is 50 and when I move the slider, I see the rows filling as expected, but the onDynXLS event does not fire.
I checked the xml returned for which looks correct.

I must be missing something simple, If you have another idea or something for me to check, I really appreciate it. It is a holiday over here today, so maybe I am just dense.

A question. When the grid first loads, should I expect the slider button size to reflect the total rows (in this case 235) or the loaded rows, here 50? The size of the slider is quite large, indicating 50 rows. So, the slider slides to the end of the 50 rows.
I hope I described this clearly


Have fun,
Paxton

There are 3 things which are need to be done, to enable dyn. loading

a) you have used load command to fill the grid
b) smart rendering is enabled
c) first xml response has total_count param

By any chance, are you loading configuration of grid from separate xml request?

should I expect the slider button size to reflect the total rows
Yes, both scroll and paging will reflect total expected count of row. So you will able jump to last one, skipping all in middle.

Hi, Stanislov.

You guys are really good, I appreciate your fast response.

By any chance, are you loading configuration of grid from separate xml request?

I am defining and initializing the grid using script from a call in the html to a function in a linked javascript file. Then, when the onload event fires, another function executes the grid.loadXML(url);

This is generally the way all the pages in my site work. I have been using your stuff for many years, just not the dynamic loading part.

I appreciate all you help, I will continue working on this and I thank you for your clear explanation of how it works.

Have fun,
Paxton

Greetings!

In an attempt to find my problem, I built another simple grid from scratch. It only loads the first xml and acts like it does not recognize the as the slider size is too large, and only the first 50 can be viewed.

Here is my code:
function buildLibrary(){

wMemLib = dhxWins.createWindow("wMemLib",505,200,540,600);  
wMemLib.setText("Member Library");
memlibTool = wMemLib.attachToolbar();
memAgrid = wMemLib.attachGrid()  ; 
var flds1 = "Albums/Tracks,Tk,Artist,UPC,Status,Media,Art,P/S"
memAgrid.setHeader(flds1);
memAgrid.setInitWidths("160,25,130,100,38,30,20,20");
memAgrid.setColAlign("220,25,165,100,38,40,20,20");
memAgrid.setColTypes("tree,ro,ro,ro,ro,ro,ro,ro");
memAgrid.setColSorting("str,int,str,str,str,str,str,str");	
memAgrid.setColumnColor("white,#F0B5FF,white,white,white,#E6E4DE,#E6E4DE,#E6E4DE");
memAgrid.setImagePath(imagepath); 
memAgrid.attachEvent("onRowSelect",doOnMemRowSelected);
memAgrid.attachEvent("onXLE",mgloadEnd);
	
memAgrid.init();
		
memAgrid.enableEditEvents(true,false,true);
memAgrid.enableDistributedParsing(true);

var memberusername = document.getElementById("usernameentry").value;
if (memberusername.length < 1){
	showDialog("Whoops!","No member username.",'warning');
	return;
}
var atOnce = 50;
 memAgrid.xmlFileUrl = oereq+'?ACTION_CODE=LIBRARY&mtype='+mtype+'&USERNAME='+memberusername;
 memAgrid.loadXML(oereq+'?ACTION_CODE=LIBRARY&mtype='+mtype+'&USERNAME='+memberusername+"&startPos=0&count="+atOnce);

}

function mgloadEnd (){
document.getElementById(“libbutton”).disabled=false;
document.getElementById(“libbutton”).value=“Get Library”;
}

function doOnMemRowSelected(){
alert(“row selected”);
}

In addition, this is the first few lines of the xml string that is returned as a result of the grid.load()

<?xml version="1.0" encoding="UTF-8"?>LOCKERJIM235

A

1


W

N

1
0
1.00
1
2
.02
112631

I hope you can see what I am missing


Thank you so much. Your software is GREAT!
Have fun,
Paxton

You need to

a) remove enableDistributedParsing command
b) add enableSmartRendering or enablePaging command ( depending on which result you want to achieve )

Beware that you will need to include dhtmlxgrid_srnd.js or dhtmlxgrid_pgn.js

Hi, Stanislav.
I guess I was asleep. Thank you for your patience.

I corrected the code, removing the enableDistributedParsing(true);
and inserting enableSmartRendering(true);

Checking to be sure dhtmlxgrid_srnd.js is linked in my html page.

I get the same symptom. The first 50 rows load, and the slider shows up
large (for 50 rows). Smart rendering is working, as I move the slider quickly I see the
additional rows render, but only 50 total. Acts like the total_count=“233” is not being recognized.

Can you think of anything else I could check?
Your patience is greatly appreciated.

Have fun,
Paxton

If you have all above commands - all must work correctly.

If issue still occurs for you - please provide any kind of sample or demo link where it can be reconstructed. ( you can PM the details )

Greetings!
OK, I have built an example that you can access at test.thedce.com/loadtest.html

I have all the JS code in the html page.

There are 243 rows available on the server. The first 50 returned.

I can give you VNC access it you wish.
Note the onDynXLS event does not fire.

Thanks so much for you attention.
Have fun,
Paxton

The problem is - you are using TreeGrid , not the Grid.
In case of TreeGrid - dynamical loading is problematic - because the position and indexes of rows are affected by the open|close state of branches.

If you need to have just a plain grid - replace “tree” with any other column type, it will fix the issue.

If you need to have dynamical loading with TreeGrid - we have some experimental code, which can add such functionality. But it may have some limitations. Please PM me if you interested in the such code.