Grid becomes read only when no data returns via json

69 views
Skip to first unread message

Marcos

unread,
Feb 7, 2012, 9:33:46 AM2/7/12
to Flexigrid for jQuery
Hi all

I've found a ... bug ?
I'm using flexigrid inside jQuery UI tabs

When data comes empty from the server, the grid becomes read only.

Here is the solution:

There is an object (g.block) that makes the grid "blocked" when it
populates, see populate function, and a few lines below you will find
these ones:

if (p.hideOnSubmit) {
$(this.gDiv).prepend(g.block);
}

Well, after this, the ajax call will transfer control to addData
function, the line looks like
g.addData(data)

This function addData removes the "blocker" (g.block) after the data
is placed in the grid, but... if no data is received, the function
ends before the blocker is removed.

A few lines before this one:
changeSort: function (th) { //change sortorder

You will find these:
if (p.hideOnSubmit) {
$(g.block).remove();
}

But over 110 lines above, you can find this block:

if (p.total == 0) {
$('tr, a, td, div', t).unbind();
$(t).empty();
p.pages = 1;
p.page = 1;
this.buildpager();
$('.pPageStat', this.pDiv).html(p.nomsg);
return false;
}

The problem is the "return false". Here ends the function before the
"remover" is executed, so the solution is very easy. Add the "remover"
before the return false. :-)

if (p.total == 0) {
$('tr, a, td, div', t).unbind();
$(t).empty();
p.pages = 1;
p.page = 1;
this.buildpager();
$('.pPageStat', this.pDiv).html(p.nomsg);
if (p.hideOnSubmit) {
$(g.block).remove();
}
return false;
}

I hope this helps

Bye all

ymkin mir

unread,
Feb 7, 2012, 2:49:14 PM2/7/12
to flex...@googlegroups.com
You may use flexigrid version from this topic:
http://code.google.com/p/flexigrid/issues/detail?id=25
Reply all
Reply to author
Forward
0 new messages