Comments (9)
@raquelleira could you please check out #335? Is it possible to change the sorting so that step (1) is disabled completely?
from ng2-table.
You can customize component as below.
ng2-table/components/table/ng-table-sorting.directive.js line:17
Then you can see these code
NgTableSortingDirective.prototype.onToggleSort = function (event) {
if (event) {
event.preventDefault();
}
if (this.ngTableSorting && this.column && this.column.sort !== false) {
switch (this.column.sort) {
case 'asc':
this.column.sort = 'desc';
break;
case 'desc':
this.column.sort = '';
break;
default:
this.column.sort = 'asc';
break;
}
this.sortChanged.emit(this.column);
}
};
This is code for switching sorting mode.
If you change this as below then you can use only two methods.
NgTableSortingDirective.prototype.onToggleSort = function (event) {
if (event) {
event.preventDefault();
}
if (this.ngTableSorting && this.column && this.column.sort !== false) {
switch (this.column.sort) {
case 'asc':
this.column.sort = 'desc';
break;
case 'desc':
this.column.sort = 'asc';
break;
default:
this.column.sort = 'asc';
break;
}
this.sortChanged.emit(this.column);
}
};
You can fort repository and use component as freely :)
from ng2-table.
I don't think they see this as an issue.
As far as I understood, When it's ascending and you click the column, it changes to descending. When it's descending and you click it, it returns to the default order of the list...(even if the default it's no order...). And then you click again, it changes to ascending again...
I think it's actually 3 different status: 1. No order/default order as it is in the array, 2. ascending 3. descending.
I'm not saying this is good though... I actually changed my code as you suggested, so this "No order" status doesn't exists anymore...
from ng2-table.
Many Thanks. Can you please push this change to the master branch?
from ng2-table.
@raquelleira How to disable the 3rd click in ng2-table/demo/components/table/table-demo.ts file? Plese suggest
from ng2-table.
@webcat12345 You are awesome!!!
from ng2-table.
@webcat12345 Is it possible to override this functionality in the file table-demo.ts of ng2-table/demo/components/table/?? I want to have only 2 way sorting in the implementation level and this is in module level. I mean if someone wants to implement my project, he will do an "npm install ng2-table" and he has to change the below code manually
case 'desc':
this.column.sort = 'asc';
break;
So is it possible to customize this in our own code which implements ng2-table?
Thanks
from ng2-table.
@webcat12345 Any solution for the above problem?
from ng2-table.
Currently there is no other way. But you can fork this repository and can make changes to component
from ng2-table.
Related Issues (20)
- i18n doesn't work in filter inputs placeholders
- TypeError: require is not a function
- How use the i18n in this component? HOT 1
- how to change line color HOT 2
- Implement ng2-table into Angular 2 Application
- All column search working on case sensitive. How to change that HOT 2
- Understanding of project setup HOT 1
- Installing ng2-table on Angular 6 HOT 2
- Is the project still maintained ?
- how forma data dd/MM/yyyy ?
- Please help me to add html button on data
- MDialog hide behind table triggered by onCellClick
- angular2 datatables are not working for dynamic data but working fine for static data HOT 1
- How i can change language?
- filtering or sorting changes column widths
- Buttons in cell
- Production Build Error
- How can i add custom templates on rows.
- Not compiling in anglar 9 Ivy renderer HOT 6
- Unable to select text in single cell
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng2-table.