EasyUI Forum
May 14, 2024, 03:00:57 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid does not reload data if it gets [] after one of reloads (1.4)  (Read 11227 times)
mzeddd
Full Member
***
Posts: 223



View Profile
« on: September 14, 2014, 01:48:02 AM »

I have the following code

Code:
var addr = 'test.php?state='+state;
$('#selectionsTable').datagrid('options').url = addr;
$('#selectionsTable').datagrid('clearSelections');
$('#selectionsTable').datagrid('clearChecked');
$('#selectionsTable').datagrid('reload');

It works fine on 1.3.6 version. But with 1.4 no.
Playing with "state" I could load something or nothing. Once I load empty data "[]" my datagrid stops showing any data even if I change "state" to new value when data exists.
« Last Edit: September 14, 2014, 01:52:27 AM by mzeddd » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: September 14, 2014, 02:30:27 AM »

You may need to provide an example or a page link to demonstrate your issue.
Logged
mzeddd
Full Member
***
Posts: 223



View Profile
« Reply #2 on: September 15, 2014, 02:21:35 AM »

I tried to build simplyfied example where I do the same as on my page where I have my problem.
But unfortunately for me it works Sad

I have added onLoadError event and it fires every time once I load no data. And continues to appear every time when I try to (re)load any data into my datagrid.
When I say no data I mean the following string:
Code:
{"total":0,"rows":[]}

Can you advice me what I should check? What could be the reason of onLoadError event?
It works fine with 1.3.6 and other versions. It started to appear with 1.4.

Thanks in advance.
Logged
mzeddd
Full Member
***
Posts: 223



View Profile
« Reply #3 on: September 15, 2014, 02:41:01 AM »

Would be good to add parameter to onLoadError which should describe reason of error.
Logged
mzeddd
Full Member
***
Posts: 223



View Profile
« Reply #4 on: September 15, 2014, 03:20:38 AM »

It took some time to find out the reason of the problem.

1) About my question above which is

Quote
Would be good to add parameter to onLoadError which should describe reason of error.

It seems like documentation for Datagrid is not completely correct, becase onLoadError has parameter which helps to understand the reason of the problem.
But in documentation I see "none"

2) About my initial problem.
Code:
onLoadError: function(arguments){alert('Load error:'+arguments.responseText);}
Using the following code I have found that page does not get any data because of SQL problem on server side.
It happened because I expect $_POST['page'] to be above 0 if it is set.

In my case $_POST['page'] was 0.

I see $_POST['page'] set to zero when I load something, then load nothing and then try to load something again.

Can you look into this two issues?

Thanks
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #5 on: September 15, 2014, 04:34:48 AM »

Please try to download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4-patch.zip. The 'page' parameter value will always be set to above 0.
Logged
mzeddd
Full Member
***
Posts: 223



View Profile
« Reply #6 on: September 15, 2014, 04:42:38 AM »

Looks good.

Thanks
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!