Pregunta

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 ?

  • Note 1: I even add onBeforeLoad:function(){return false;} and still sends the unwanted request.
  • Note 2: The requests headers are the same, except for the Content-Length. (of course).
  • Note 3: Related question here: http://www.jeasyui.com/forum/index.php?topic=560.0 (I already check it)
  • Note 4: The version is: v1.10.4

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:[[.....]],

});
¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top