We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How can i sort grid according to specific column

please tell me about how can i get sorted record in grid according "todatvalue "
also tell about ascending and descending


<div id="Grid" ej-grid e-datasource="data1" e-toolbarsettings-showtoolbar='true' e-editsettings-addnewrow="bottom" e-toolbarsettings-toolbaritems='tools' e-editsettings-allowdeleting=' true'
                     e-editsettings-allowediting='true' e-editsettings-allowadding='true' e-allowpaging="true"   e-beginedit="disableedit"
                     e-editsettings-editmode='dialogtemplate' e-editsettings-inlineformtemplateid="#template" e-selectedrowindex="selectedRow" e-allowsorting="true" e-endedit="endedit" e-actioncomplete="complete">
                    <div e-columns>
                        <div e-column e-field="leave_id" e-headertext="Leave" e-isprimarykey="true" e-textalign="center"></div>
                        <div e-column e-field="fromdateValue" e-headertext="From Date" e-textalign="center" e-format="{0:dd-MMM-yyyy}"></div>
                        <div e-column e-field="todatevalue" e-headertext="To Date" e-textalign="center" e-format="{0:dd-MMM-yyyy}" e-allowsorting="true"></div>
                        <div e-column e-field="leave_days" e-headertext="Leave days" e-textalign="center"></div>
                        <div e-column e-field="reason" e-headertext="Reason" e-textalign="center"></div>
                        <div e-column e-field="status" e-headertext="Status" e-edittype="dropdownedit" e-datasource="leave_status" e-textalign="center"></div>
                    </div>
                </div>
        </div>

4 Replies

GO Gomtesh March 17, 2015 07:29 AM UTC

Please tell me solution in angular not in jquery


BM Balaji Marimuthu Syncfusion Team March 18, 2015 12:23 PM UTC

Hi Gomtesh,

Thanks for using Syncfusion Products.

Query: please tell me about how can i get sorted record in grid according "todatvalue " also tell about ascending and descending. Please tell me solution in angular not in jquery

Do you want to get the Sorted Columns value such as if the “todate” column is sorted, then the sorted column value field “todate” and the direction is “ascending/ descending” or something else? Or you want to get the complete sorted grid records? Kindly explain the scenario more clearly. So that we could provide you with the solution.

Regards,

Balaji Marimuthu



GO Gomtesh March 19, 2015 04:11 AM UTC

yes i have to get all grid record in according to todate value column in descending order but i perform operation on any record then descending order is not in grid if edit one record then also all grid records should according to todate value descending oder


BM Balaji Marimuthu Syncfusion Team March 20, 2015 04:09 PM UTC




Hi Gomtesh,

Based on your requirement we have created the sample and the same can be downloaded from the following link.

Sample: Sample-118341.zip

<div id="Grid" ej-grid e-datasource="filtered>

. . . . . .

</div>

<script>

angular.module('listCtrl', ['ejangular'])

.controller('PhoneListCtrl', function ($scope, $compile,$filter) {

. . . . . .

$scope.filtered = $filter("orderBy")($scope.data1, "+to_date", true);

});

</script>

Your requirement is achieved by using the angular filter service in the Grid, and the sorting performed by the orderBy in angular. And the $scope.filtered record is binding to the Grid dataSource. We can get the sorted records by using the $scope.filtered.

Are you asking the mentioned behavior in your Grid or you need anyother requirement additionally, could you please provide more information regarding your requirement that will helpful to provide better solution ASAP.

Regards,

Balaji Marimuthu


Loader.
Live Chat Icon For mobile
Up arrow icon