on 09-08-2015 7:01 AM
hi Expert,
I have a table with 4 columns. I'm showing color in one of the column in my table. I'm changing the color in table based on input field. I want to sort based on color. How can I do that.
Thanks,
Ashok.
<table:Table rows="{
path: '/table',
sorter: [{
path: '<colorCodeField>',
descending: false
}]
}">
Try This...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have provided you the answer in another thread (apart from your main question). Now, you can asking the same thing here. And JSBin sample is provided. Sorry I do not understand how to support you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
var oBarCodeValue = this.getView().byId('idBarCode').getValue();
var data = this.getView().getModel('tableModel').getData().results;
var oLength = this.getView().getModel('tableModel').getData().results.length;
for(i=0;i<oLength;i++){
var oBarValue = this.getView().byId('idTable').getItems()[i].getCells()[1].getText();
if(oBarCodeValue === oBarValue){
var oColor = this.getView().byId('idTable').getItems()[i].getCells()[0];
oColor.setColor('#00FF00');
this.getView().byId('idTable').getItems()[i].getCells()[1].setState('Success');
this.getView().byId('idTable').getItems()[i].getCells()[2].setState('Success');
this.getView().byId('idTable').getItems()[i].getCells()[3].setState('Success');
}
var oColorValue = this.getView().byId('idTable').getItems()[i].getCells()[0].getColor();
var oSorter = new sap.ui.model.Sorter('Color');
oSorter.fnCompare = function(a,b) {
if (a === b) {
return 0;
}
}
}
Here is the jsbin sample
JS Bin - Collaborative JavaScript Debugging
Please tell me what is/are not working.
In your sample, there are many unrelated code and you create sorter and sorter is not used.
Please spend some time reading about SAPUI5. It will help you in the long run.
-D
If you put your code in JSBIN is better to solve your problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Step 1 - > JS Bin - Collaborative JavaScript Debugging and login with your ID.
Step 2 -> Type your code HTML JS and CSS
Step 3 -> In write corner there will be Bin Info. Click on that
Step 4 -> Cick clone and copy URL and post here.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.