EasyUI Forum

General Category => General Discussion => Topic started by: l3917055 on February 27, 2013, 12:43:07 AM



Title: a suggestion about datagrid
Post by: l3917055 on February 27, 2013, 12:43:07 AM
sometimes,I used column's formatter or any other cause sort field and display field is not the same

I mean I need a different field to sort, different from the display field。

I think, easyui can use  the display field to sort when the sortfiled property is not define
          and easyui should  use the sortfiled property  when the sortfiled is defined 


Title: Re: a suggestion about datagrid
Post by: l3917055 on February 27, 2013, 08:43:41 PM
like this
  columns: [[{ field: 'Name', title: 'Name', width: 80,sortField:'otherFiled' , sortable: true },
                  { field: 'Email', title: 'Email', width: 80, sortable: true }
               ]],


Title: Re: a suggestion about datagrid
Post by: azizkhani on January 15, 2015, 10:53:22 AM
like this
  columns: [[{ field: 'Name', title: 'Name', width: 80,sortField:'otherFiled' , sortable: true },
                  { field: 'Email', title: 'Email', width: 80, sortable: true }
               ]],


hi
i have this problem too
how can solve your problem  ??? ??? ???


Title: Re: a suggestion about datagrid
Post by: stworthy on January 15, 2015, 06:47:04 PM
Before a request is made to load data from remote server, the 'onBeforeLoad' event fires, in which you can change any request parameters including the sort name.
Code:
$('#dg').datagrid({
onBeforeLoad: function(param){
if (param.sort == 'Name'){
param.sort = 'otherField';
}
}
})


Title: Re: a suggestion about datagrid
Post by: azizkhani on March 26, 2015, 08:51:49 AM
Before a request is made to load data from remote server, the 'onBeforeLoad' event fires, in which you can change any request parameters including the sort name.
Code:
$('#dg').datagrid({
onBeforeLoad: function(param){
if (param.sort == 'Name'){
param.sort = 'otherField';
}
}
})


how can override datagrid to add sortname property to field to dose not force to write this bad code for all my grid
plz help me