Hybrid View

  1. #1
    Sencha User
    Join Date
    May 2007
    Posts
    45
    Vote Rating
    0
    hui2008 is on a distinguished road

      0  

    Default


    Dear all,

    I create a grid, and in the columns, I want to do this:

    {id:?(I want to the value of this id equal the value of this dataIndex),header: 'title', dataIndex: 'priority',sortable:true, width: 90},
    like this, if priority=6 I want to id:'6',
    if priority=7 I want to id:'7',

    who can help me?

    thanks!

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,164
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  3. #3
    Sencha User
    Join Date
    Aug 2007
    Location
    Edinburgh
    Posts
    49
    Vote Rating
    0
    lburgess is on a distinguished road

      0  

    Default


    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.

  4. #4

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,164
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    You need to use a renderer.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6

  7. #7
    Sencha User
    Join Date
    May 2007
    Posts
    45
    Vote Rating
    0
    hui2008 is on a distinguished road

      0  

    Default


    I do this:

    PHP Code:
    {id:'prbg',header:'mytitle',dataIndex:'priority',align:'center',sortable:true,width:90,renderer:this.bgcolor}, 
    [PHP]bgcolor:function(value){
    var bg;
    if(value == '5'){bg=