Ext.JS is there a way of tracking sort events on a grid panel?

I've got two form fields, one select list, and another grid panel. Changing the selection in the select list will trigger its change event and fire a custom event called datasourcechange which the grid panel listens for. These two components have to be separate because they are used across different forms and not always together.

The problem is that when I sort the grid panel, it fetches an unfiltered list of records. I would like it to reapply the filter from the select list, if it's available.

I've tried remoteSort: false , but was thinking I could do something similar to how the select list fires an event that the panel is listening for, but I need a way to determine when the column headers have been clicked, either via a sort event or click event on the headers themselves, could anyone recommend a best practice approach for this?

We are using Extjs 4.0.5, and can't upgrade to 4.1.x. Any assistance is appreciated!


That´sa common problem. What you have to do is implement something like this:

  • When changing the selection in the select list, save the selected value on the grid´s store.

    var store = getGridStore(); // you have to implement this method store.selectedValue = theSelectedValue;

  • Next, you have to subscribe to the store´s load event in order to apply the filter before perform the request. This is, something like this:

    getGridStore().on('beforeload', function (store) { store.proxy.extraParams = { filteredByValue: store.selectedValue }, this);

  • I don´t know how your implementation is, however this describes the general idea.

    链接地址: http://www.djcxy.com/p/19542.html

    上一篇: 以编程方式将记录添加到ExtJS中的网格后切换单元格编辑器

    下一篇: Ext.JS有一种跟踪网格面板上的排序事件的方法吗?