EasyUI datagrid sends an unwanted request

I have a datagrid (table) that when created, it sends two requests:

  1. the first is an unwanted (not send by me) it has no parameters (only rows and pagination when pagination settings is active), it does go the the intended URL.
  2. the second is what I programmed (it works fine, with the parameters I send).

So the question is, what fires that request ?


Here is the code:

HTML

<table
    id="data-grid" 
    class="easyui-datagrid"
    style="width:690px; height:660px"
    url=""
    title=""
    rownumbers="false"
    pagination="false"  
    singleSelect="true"
    pageList="[10,20,30,1000]"
    pageSize="1000"
    >
    <thead>
        <tr>
        </tr>
    </thead>
</table>

JavaScript

$('#data-grid').datagrid({
    //Lets add the parameters
    queryParams: {
        status_a:   a),
        status_b:   b,
    },
    url: '/path/path',
    columns:[[.....]],

});

Upvotes: 2

Views: 2509

Answers (1)

Here is the solution:

Remove class="easyui-datagrid" from the HTML inside the <table></table> definition.

When a element has 'class="easyui-datagrid"' attribute, it will be auto created as datagrid component. You don't need to create it again with javascript code. To prevent from making duplicate request to server, don't create datagrid more than once. If you wish to create datagrid in javascript, the simplest way is to remove 'class="easyui-datagrid"' from the element.

More information here: jeasy topic

Upvotes: 3

Related Questions