jqGrid: subgrid doesn't populate with data

前端 未结 1 1654
醉梦人生
醉梦人生 2021-01-25 17:11

I\'ve got a subgrid that, when you click the \"+\" sign next to \"Cheese\", the ajax query fires, and I see the subgrid column names, but the actual data isn\'t populated into t

相关标签:
1条回答
  • 2021-01-25 17:39

    I could reproduce the problem and analysed the code of subgrid module of jqGrid. My explanation is: the new expandOnLoad: true property of the subGridOptions which you use can work only in case of 'local' datatype on the main grid. I don't found the corresponding remark about this in the documentation, but it is so.

    In the version 4.1 are used delayOnLoad option, but it didn't works correct. In the version 4.1.1, after the fix the option are not used and immediately after adding a row in the main grid. The problem is that jqGrid use .grid.hDiv.loading property to skip ajax request if the response of the previous ajax request are not processed till the end. Inside of beforeSend handler of the $.ajax request of the main grid (see here) will be called beginReq() which first line is

    ts.grid.hDiv.loading = true;
    

    then inside of success handler of the $.ajax request the addXmlData method will be called, which call addSubGrid for every row of the main grid, which call .trigger('click'); on the "expand" icon of the grid row. As the result the populatesubgrid will be called on all grid rows before the .grid.hDiv.loading will be chaned to false inside of endReq at the end of success handler. So in the corresponding part of the populatesubgrid method where the ts.grid.hDiv.loading will be tested the corresponding $.ajax call will be skipped and the rows will be not expanded.

    So I can repeat the short result of my analyses: don't use expandOnLoad: true option. It is not work on remote data.

    0 讨论(0)
提交回复
热议问题