EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rbhakta on May 31, 2012, 12:44:46 PM



Title: Datagrid calling URL 2 times, 1st without query
Post by: rbhakta on May 31, 2012, 12:44:46 PM
I am on 1.2.6 and using firefox; my datagrid seemly works OK for the most part, but I have notice thru FireBugs, that the data URL is being called 2 times, and on the 1st time, there is no query parameters sent.  My javasript is below, server is json service return all the alert records if the "serviceId" parameter is not specified, or return specific alert records when the "serviceId" is specified.

   $(function()
   {
      $('#tt-alert').datagrid({
         url: '<c:url value="/gui/alert/getFilteredAlerts.json"/>',
         width: 'auto',
         height: $(window).height()-200,
         queryParams: {serviceId: ${service.id} },
         onDblClickRow:function( rowIndex, row  )
         {
            genericEdit('tt-alert','alert-dlg','alert-form','Alert',true );
         }
      });
   });



In firebugs, I clearly see 2 calls URL, the 1st with the seviceId parameter and the 2nd without.  So, I like to understand (and fix)
1) Why the URL is being called 2 times.
2) Why the 2st call is without parameters
3) Why does the content of the datagrid seem random (sometimes result from the 1st call, and sometimes results from the 2nd call)


Any advise would be appreciated.




Title: Re: Datagrid calling URL 2 times, 1st without query
Post by: stworthy on May 31, 2012, 05:33:57 PM
How do you define your datagrid in existing <table> element? If you define as:

<table id="tt-alert" class="easyui-datagrid">
...
</table>

Please remove the class "easyui-datagrid". Adding this CSS class will make the datagrid to be created. Call the following code will create the datagrid again:
$('#tt-alert').datagrid({...});

This is why the URL being sent twice.


Title: Re: Datagrid calling URL 2 times, 1st without query
Post by: rbhakta on June 01, 2012, 10:35:36 AM
After remove the class,  It works! 

Thank you, Thank you!!!


Title: Re: Datagrid calling URL 2 times, 1st without query
Post by: Tareq on January 06, 2013, 08:28:19 PM
it worked for me too after removing the class from the table...