27
I made a little update to the livegrid.js wich should visually improve the scrolling (a lot!)
Also, here’s the source for the dummy output file getrows.php wich is used at the demo
So, what does the grid expect as input….
The output should always be wrapped by <ajax-response></ajax-response>
de <ajax-response> tag CAN contain the rowcount attribute wich should indicate the number of rows in this request. If it’s not specified the grid tries to figure it out itself. It CAN also contain the totalrows attribute. If that attribute is filled (with the total dataset rowcount), it overrules the initial value set by javascript. Each row within the resultset should contain a rownum=”i” where i starts at 0 (zero) for every request….
23 Responses to “Improved the scroll”
Andreas Schultz says:
Jul 28, 2005
Hi,
The regular expression matching in LiveGridBuffer::getRows() slows down to crawl if the returned content is a bit more complicated (contains more tags) than your example.
Is there any way to replace it with something faster? Maybe using an XPath query on the returned XML?
Andreas
Alley=>Chris van de steeg says:
Jul 28, 2005
@Andreas: Hmm, using XPath would be a good idea indeed. But then the xml input should always be valid, as where now it can also contain crappy-html output if you like
… Maybe I should check if the xml is valid and if so, use XPath.
Do you have an example of the complex version somewhere setup?
I won’t be doing any updates the coming week.. I’ll be on Holiday. But this could be a nice feature for when I get back
Andreas Schultz says:
Jul 29, 2005
I found a solution. Replacing the complex regular expression with two much simple versions helps a lot. I’m now down from 30 seconds to 43 milliseconds.
Here is what i use now:
getRows: function(start, count) {
var begPos = parseInt(start) - this.startPos
var endPos = begPos + parseInt(count)
var s, e;
if ((s = this.rows.search('= this.size )
{
endPos = this.size;
end = ''
}
else
end= '
gk says:
Aug 9, 2005
Andreas are your changes very specific or are they usefull for any html.
I am experiencing some performance problems too, could you post your exact code?
gk says:
Aug 9, 2005
This makes a huge difference for me, from 1min 30 to around 0.5sec
getRows: function(start, count) {
var begPos = parseInt(start) - this.startPos
var endPos = begPos + parseInt(count)
var s,e;
s = this.rows.search('= this.size )
{
endPos = this.size;
e = this.rows.search('');
}
else
e = this.rows.search('
William Reed says:
Aug 11, 2005
I cannot get this to work I get a js error below…
OBJECT REQUIRED.
Breaks me at this line…
if (ajaxResponse.responseXML.childNodes[0].getElementsByTagName)
William Reed says:
Aug 11, 2005
Scratch that now I just get object expected and it goes to the tag….help.
Alley=>Chris van de steeg says:
Aug 13, 2005
@Andreas & gk:
great work! I’ll test your lines the next few days (I was on a Holiday) and post them
gk says:
Aug 15, 2005
Re: sortable columns, i’ve implemented sorting using additionalParms but I can’t refresh the datagrid unless I scroll.
do you how to force livegrid to refresh with a few simple calls?
Alley=>Chris van de steeg says:
Aug 15, 2005
@gk: you can use mygrid.requestContentRefresh(0) to update the grid
William Reed says:
Aug 15, 2005
Is there a simple write up on how to implement this? I get tons of errors trying to implement, have no idea if I am doing it right??????
gk says:
Aug 15, 2005
thanks, but that doesn’t work for me, I still have to scroll to get it to update, the only thing that works for me atm is deleting and creating a new grid but then I have two scrollbars.
gk says:
Aug 15, 2005
joy this works.
myGridUpdater.additionalParms = ‘sort=’+sortExp;
//set to -1 to force buffer update, i think!
myGridUpdater.requestContentRefresh(-1);
myGridUpdater.requestContentRefresh(0);
thanx
Alley=>Chris van de steeg says:
Aug 16, 2005
@gk: hehe, yeah that will work ![]()
But that’s not the intention… I didn’t know you wanted a ‘fresh’ refresh..sorry.
The way to do a forced reget of the data is:
myGridUpdater.fetchBuffer(0, true);
Alley=>Chris van de steeg says:
Aug 16, 2005
@William Reed: sorry, really no time for such.
You could look at the original rico grid at openrico.org, they have a manual
gk says:
Aug 17, 2005
Found the problem, the code in this function meant that the offset had to be changed to update, I commented out those lines, another hack but works myGridUpdater.fetchBuffer(0, true) works fine now
replaceCellContents: function(buffer, startPos) {
//if (startPos == this.lastDisplayedStartPos){
// return;
//}
this.lastDisplayedStartPos = startPos
this.table.innerHTML = buffer.getRows(startPos, this.metaData.getPageSize());
},
William Reed says:
Aug 17, 2005
The manual on rico is awful, its like reading a foreign manual trying to get this to work, I just want to know how to get it to work on ASP. I get the XML working fine but the javascript and the necessary ASP I dont have working.
Alley=>Chris van de steeg says:
Aug 17, 2005
@gk: could you please email me the code that you changed for the regular expression search? It doesn’t seem to be posted ok in the comments
Alley=>Chris van de steeg says:
Sep 27, 2005
@Karthikeyan : what do you mean ? Have a look at the latest version @ http://blog.ilikeu2.nl/2005/09/10/livegrid-now-comes-with-xslt/
Ozkan says:
Mar 24, 2006
It’s really unbelievable, there are no guide to successfully implement the LiveGrid !!!
I am trying for 4 days and still cannot recieve data with many many JS errors!!
Now i give up and gonna try another method to publish my data.
bores says:
Nov 19, 2007
gk Says:
>joy this works.
>myGridUpdater.additionalParms = ’sort=’+sortExp;
>//set to -1 to force buffer update, i think!
>myGridUpdater.requestContentRefresh(-1);
>myGridUpdater.requestContentRefresh(0);
That in real act 2 requests.
edit this:
replaceCellContents: function(buffer, startPos) {
if (startPos == this.lastDisplayedStartPos && this.filterFlag == 0){
return;
}
this.lastDisplayedStartPos = startPos;
this.table.innerHTML = buffer.getRows(startPos, this.metaData.getPageSize());
},
that right
