This is a migrated thread and some comments may be shown as answers.

[Solved] OnDataBinding Client Event

1 Answer 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gabe
Top achievements
Rank 1
Gabe asked on 28 Mar 2011, 08:04 PM
I would like to handle my sorting with a client side event.
So something like this:

.ClientEvents(e => e.OnDataBinding("sortColumn"))

then:

function sortColumn(e) {
 
    try {
       
       // What type of command fired this event? Is there something i can do to determine why the event was fired such as...
       // if (e.type == "sortedcolumn") { // do things }


       // Single column sort only...
       
       $.getJSON("MyController/Action/", { SortedColumns: e.sortedColumns  }, function (data) {
// rebind data here.... $('#mygrid).data('tgrid').dataBind(data.Data);  }, 'json');    }     catch (x) {      } }

Is there a way to detect what create the databinding event to be fired? Like command = sortedcolumn

I know there is other ways to do this like creating a custombinding scenario, but I would like to handle it like the above. Is this a bad approach ?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 29 Mar 2011, 07:31 AM
Hi Gabe,

Currently it is not possible to determine what caused the OnDataBinding event to trigger (paging, sorting, filtering or grouping). Normally you would like to implement sorting in all those cases - for example the paging should display sorted data etc.

Regards,
Atanas Korchev
the Telerik team
Tags
Grid
Asked by
Gabe
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or