angularjs - kendo TreeList: sort columns based on parent element only? -
here example kendo treelist. how can sort data in treelist, depending on values based on parent element?
in example, if sort data on column 'p names', child elements sorted. how can sort parent elements?
thanks in advance.
you need add custom comparer column.
look in kendo docs
in case this:
$("#grid").kendogrid({ datasource: datasource, sortable: true, columns: [{ field: "item", sortable: { compare: function(a, b) { if(a.level>1){ var datarows = $scope.grid.items(); var arowindex = datarows.index(a); var browindex = datarows.index(b); return arowindex > browindex ; } else return a.item> b.item; } } }] });
Comments
Post a Comment