PDA

View Full Version : how to make checkbox as checked



rubynile
11 Aug 2009, 6:04 AM
In my list am including checkbox.In new mode it shouldnt mark as checked.But in update mode it should mark as checked.How to do this.Some one help me..

rehanazher
11 Aug 2009, 6:10 AM
Can you provide some code for better understanding?

rubynile
11 Aug 2009, 8:39 PM
Am using this inside a form.In new mode i want the checkbox as unchecked and allow the user to check.But during updation it should be checked automaticaly when data from database cum to form in update mode.



//This is the check box:

chkBox = new Ext.grid.CheckboxSelectionModel();

//This is my store:

quoteStore = new Ext.data.Store({id:'quoteStore',autoLoad:isAutoLoad,url:'../crm/getSalesQuoteBillboardList.jsp?quote_id='+quote_id,
reader:new Ext.data.ArrayReader({},quoteRecord)
});
//This is my data model:
quoteDataModel = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),chkBox,
{header:'<b>Media Code</b>',dataIndex:'code_billboard',align:'left',sortable:true,width:80,editor: new Ext.form.TextField({name:'biiboard_name',id:'biiboard_name'})},
{header:'<b>State/Location</b>',dataIndex:'location',align:'left',sortable:true,hidden:true,editor: new Ext.form.TextField({name:'location',id:'location'})},
{header:'<b>Base Rate</b>',dataIndex:'rentalprice',align:'left',sortable:true,width:80,
editor: new Ext.form.NumberField({allowBlank:false,allowNegative: false})},
......
....
]);

//This is my grid
var quoteDataGrid = new Ext.grid.EditorGridPanel({
id:'quoteDataGrid',
loadMask:true,
sm:chkBox,
defaultType: 'checkbox',
height:200,
autoScroll:true,
cm:quoteDataModel,
width:850,
store:quoteStore,
frame:true,
clicksToEdit:1,
disabled:readOnly,
loadingText:"Loading",
tbar:[{ }]
});

//This is my tabpanel where am using the grid
Gideform=new Ext.Panel({
layout:'form',
id:'Gideform',
title:'Media Transaction',
height:530,

frame:true,
items: [
quoteDataGrid,
{
layout:'column',
border:false,
disabled:readOnly,
labelWidth:130,
items:[{
columnWidth:.3,
layout: 'form',
border:false,
items: [ {id:'quote_gst',tabIndex:'4',name:
'quote_gst',xtype:'numberfield',fieldLabel: 'GST (%)',value:sGst,labelSeparator:'',width:30
}
]
},{
columnWidth:.3,
layout: 'form',
border:false,
items: [ {id:'quote_agcom',tabIndex:'5',name:
'quote_agcom',xtype:'numberfield',fieldLabel: 'Media Specialist(%)',
value:aGcom,
labelSeparator:'',width:40
}]
},{
columnWidth:.3,
layout: 'form',
border:false,
items: [
{id:'quote_net',tabIndex:'7',readOnly:true,name: 'quote_net',align:'left', value:sNetTotal,
xtype:'textfield',fieldLabel: 'Net Total',labelSeparator:'',
listeners: {'focus': netTotal },width:80,align:'left'}]
}]
}
]
});