PDA

View Full Version : Row Expander checking condition



AtulDawkhare
14 Mar 2012, 3:27 AM
Hi
I have Grid with "rowexpander". with this I am able to expand the row, and able to show the content .i.e. html checkbox.
Now my requirement is the in my DB I got the value true or false. So depending upon the value i.e. true I want show check box with checked.

Here is my code.

plugins: [
{
ptype: 'rowexpander',
rowBodyTpl:
['<ul><li><input type="checkbox" name="" checked={marginAccess} ><span>Margin Access for Quote</span></li></ul> ']
}


Now {marginAccess} when is it true I want to show "<input type="checkbox" name="" checked=checked>"
i.e. checked = checked

I am not able to do this, Can you please suggest me ?

droessner
14 Mar 2012, 5:22 AM
Try this:



plugins: [{
ptype: 'rowexpander',
rowBodyTpl: [
'<ul><li><input type="checkbox" name="" {[values.marginAccess ? "checked=checked" : ""]}><span>Margin Access for Quote</span></li></ul> '
]}

AtulDawkhare
14 Mar 2012, 6:22 AM
not working it always print checked= checked.

Actually in my Model the type was String, even through I changed to Boolean still, it is not considering the false value.

Can you please suggest?



Ext.define('Grid_Model', {extend: 'Ext.data.Model', fields: [
{name : 'marginAccess',type: Boolean}




plugins: [
{ ptype: 'rowexpander',
rowBodyTpl:['<ul><li><input type="checkbox" name="" checked={[values.marginAccess ? "checked=checked" : "somestring"]} ><span>Margin Access for Quote</span></li></ul> ']
}
]

droessner
14 Mar 2012, 6:32 AM
Try:



Ext.define('Grid_Model', {
extend: 'Ext.data.Model',
fields: [{
name : 'marginAccess',
type: 'boolean'
}
...





plugins: [{
ptype: 'rowexpander',
rowBodyTpl: ['<ul><li><input type="checkbox" name="" {[values.marginAccess ? "checked=checked" : ""]}><span>Margin Access for Quote</span></li></ul> ']
}]
...

AtulDawkhare
14 Mar 2012, 6:56 AM
Thanks a lot its working now :)