grid - ExtJS 3: How to define different actions to different rows based on the values in the row? -
in grid panel
supports adding,editing , deleting rows, want define different actions different rows based on values in row. like,
on add
, 1 new row added in grid. have column
in grid has combo editor
( can select either yes
or no
). if value no
, disable next column textfield , column has button hyperlink. , if value yes
, want textfield , button enabled.
i tried textfield , button using ext.getcmp()
, use disable()
, happens is, action
applied column in rows of grid, whereas want applied particular row have selected value.
to more clear, let me explain example.. assuming grid used storing phone number entries has 3 columns,
- column 1 -
has phone number?
- column 2 -
provide phone number
- column 3 -
look user name
here, add row 1 grid,choose value no
has phone number
flag, based on code, use ext.getcmp
, textfield , button , invoke disable
method, column 2 , 3 disabled.
in row 2, choose value yes
flag,so ideally should able modify column 2 , 3 of row 2.
but, happens is, along row 2, columns in row 1 getting enabled because chose yes
time.
so, wanted know how apply actions columns of row based on value particular row. , next row, should independent of actions applied current row... looking help/ guidance in resolving issue.
i using ext js version 3.4
thanks
you can access current record in getclass
, handler
method change aspect , action of column depending on row :
new ext.grid.gridpanel({ store: mystore, columns: [ { xtype: 'actioncolumn', width: 50, items: [ { getclass: function(v, meta, rec) { // or return class function if (rec.get('change') < 0) { this.items[1].tooltip = 'do not buy!'; return 'alert-col'; } else { this.items[1].tooltip = 'buy stock'; return 'buy-col'; } }, handler: function(grid, rowindex, colindex) { var rec = store.getat(rowindex); alert("buy " + rec.get('company')); } } ] } //any other columns here ] });