0
votes

I am using ExtJs 4.1 grid. I have enabled the remoteSort in the store & enabled sortable property for the columns. Everytime I sort\click on column header, a call is made to the server with sort params being passed in the query string.

I want to know if there is a client side event, which gets fired before call is made to the server? I want to check certain condition and based on that I may cancel the call to the server.

Please suggest.

1

1 Answers

1
votes

There is a sortChange event that gets fired whenever you sort the grid.

See the documentation here.

I have created a fiddle demo that logs to the console every time the grid is sorted. It should help.

If that doesn't work you'd likely need to attach to the stores beforeSort or the refresh event.

EDIT: As the beforeSort event is not available for ExtJs Version 4, you'd likely need to listen to the refresh event:

Refresh: Fires when the data cache has changed in a bulk manner (e.g., it has been sorted, filtered, etc.) and a widget that is using this Store as a Record cache should refresh its view.