Hybrid View
-
27 Jul 2008 5:25 PM #1
How to define a grid's columns id
How to define a grid's columns id
Dear all,
I create a grid, and in the columns, I want to do this:
like this, if priority=6 I want to id:'6',{id:?(I want to the value of this id equal the value of this dataIndex),header: 'title', dataIndex: 'priority',sortable:true, width: 90},
if priority=7 I want to id:'7',
who can help me?
thanks!
-
27 Jul 2008 5:32 PM #2
That doesn't make sense. The column could have more than 1 priority value, so it doesn't make sense to do that.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
27 Jul 2008 5:48 PM #3
I assume that there is a potential for the same prority to appear in multiple rows?.. If so, you should be looking to set a class instead, as all DOM element ids should be unique.
That aside, using a simple number (especially for DOM elements relating to a record) is probably not recommended anyway, as such I id would have a high likely hood of being prescribed again and again throughout your app.. which could get very messy
I may get a chance to look into a possible solution, if I do (and no one else beats me to it), I'll post some code up.
-
27 Jul 2008 6:07 PM #4
Thanks very much
Thanks very much
Thanks very much
-
27 Jul 2008 6:22 PM #5
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
27 Jul 2008 7:04 PM #6
-
27 Jul 2008 10:48 PM #7
I do this:
PHP Code:{id:'prbg',header:'mytitle',dataIndex:'priority',align:'center',sortable:true,width:90,renderer:this.bgcolor},
add css:PHP Code:bgcolor:function(value){
var bg;
if(value == '5'){bg="#666666"}
else{
bg="#ff0000"
}
return String.format('<div style="padding:3px;background-color:{1}">{0}</div>',value,bg);
}
but I think this is not a perfect solutionPHP Code:.x-grid3-col-prbg{padding:0;}


Reply With Quote
