I want to sort the two columns, which are related to the example: I sort a name, and Then I want to sort the list name according to date, but, when I do this, it overwrites my type and changes it according to date and ignores this type on the basis of name,
Is it possible to date a date by name? When do you click on the top? If someone can give me a hint, please?
$ scope.filteredList = null; $ Scope.orderByName = function (intermediate, reverse) {if ($ scope.filteredList == zero) {$ scope.dataList = $ filter ("orderby") ($ scope.dataList, predicate, reverse); $ Scope.filteredList = $ scope.dataList; } And $ scope.dataList = $ filter ("orderby") ($ scope.filteredList, predicate, reverse); $ Scope.filteredList = $ scope.dataList;}} $ $ scope.orderByDate = function (bottom, reverse) {If ($ scope.filteredList == zero) {$ scope.dataList = $ filter ("orderby") ($ scope.dataList, predicate, reverse); $ Scope.filteredList = $ scope.companyInfo;} and ($ scope .companyInfo = $ filter ("orderby") ($ scope.filteredList, predicate, reverse); $ Scope.filteredList = $ scope.dataList;}}; HTML: & lt; a ng-click = "reverse =! Reverse; Orderbayanam ('date', reverse) "> an ng-click =" reverse =! Reverse; orderbreeder ('name', reverse) "> code here That's me I use it, but every time I click on any column, then this data changes again.
You may want to write your own order through the function. Your HTML can look like:
ng-repeat =" employee in staff order: my assertfunction "
In your function, you can type something like this:
$ scope.mySortFunction = function {employee} {return employee. Name + '~' + employee .Date; }; In your case, the code below should work: $ scope.filteredList = null; $ Scope.orderByName = function (intermediate, reverse) {$ scope.sortedOnName = true; If ($ scope.filteredList == zero) {$ scope.dataList = $ filter ("orderby") ($ scope.dataList, predicate, reverse); $ Scope.filteredList = $ scope.dataList; } And $ scope.dataList = $ filter ("orderby") ($ scope.filteredList, predicate, reverse); $ Scope.filteredList = $ scope.dataList;}} $ $ scope.mySortFunction = function (data listing) { Return Data ListEnment.name + '~' + Data ListAddmentDate;} $ Scope.orderByDate = function (predicate, reverse) {if ($ scope.sortedOnName) {if ($ scope.filteredList == zero) {$ scope.dataList = $ Filter ("orderby") ($ scope.dataList, $ scope.mySortFunction, reverse); $ Scope.filteredList = $ scope.companyInfo;} and ($ scope.companyInfo = $ filter ("orderby") ($ scope .filteredList, $ scope.mySortFunction, reverse); $ Scope.filteredList = $ scope.dataList;}} and {if ($ scope.filteredList == faucet) {$ scope.dataList = $ filter ("orderby") ($ Scope.dataList, predicate, r S); $ Scope.filteredList = $ scope.companyInfo;} and ($ scope.companyInfo = $ filter ("orderby") ($ scope.filteredList, predicate, reverse); $ Scope.filteredList = $ scope.dataList;} }};
Theoretically it should, but if you make some corrections to make it work, please let me know so that I can update the answer.
No comments:
Post a Comment