EasyUI Forum
September 14, 2025, 04:45:22 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 calling URL 2 times, 1st without query  (Read 15964 times)
rbhakta
Newbie
*
Posts: 2


View Profile
« 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.


Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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.
Logged
rbhakta
Newbie
*
Posts: 2


View Profile
« Reply #2 on: June 01, 2012, 10:35:36 AM »

After remove the class,  It works! 

Thank you, Thank you!!!
Logged
Tareq
Newbie
*
Posts: 4


View Profile
« Reply #3 on: January 06, 2013, 08:28:19 PM »

it worked for me too after removing the class from the table...
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!