PDA

View Full Version : checkbox value dosen't set value from server side



MohamedFawzy_
11 Mar 2013, 5:50 AM
Hello,

data back from server side correctly here is my json response


{"total":1,"success":true,"locks":[{"id":"1","record_id":true,"is_unreachable":true,"is_directory_Lock":true,"is_Internet_Lock":false,"is_partner_Lock":true,"is_home_business":true,"is_top_listing":true,"is_mole":true,"is_pre_call":true,"is_new_business":true,"is_free_adv":true,"is_verified":true,"is_reviewed":true,"is_idr":true}]}

for example is_unreachable is check here but not checked when render extjs checkbox value

checkbox view


Ext.define('UserApp.view.uiTypes.LockFeature',{
extend: 'Ext.form.Panel',
collapsible: true,
flex: 1,
height: 200,
width: 600,
store: null,
itemId: 'lockfeature',
layout:{
type: 'table',
columns: 3
},

items:[{

xtype: 'checkbox',
boxLabel: 'Is Unreachable',
name: 'is_unreachable',
inputValue: true,
unCheckValue: false,
id: 'is_unreachable',
value: true,
dataIndex: 'is_unreachable'
},{

xtype: 'textfield',
name: 'is_unreachable_update',
fieldLabel: 'Last Update',

},{
xtype: 'textfield',
name: 'update_by_user',
fieldLabel: 'By'
}],


initComponent: function(){
console.log(this.table);
console.log(this.record_id);
var table = this.table;
var parentTable = table.split('_');
console.log(parentTable[0]);
var store = Ext.create('UserApp.store.LockFeature');
store.getProxy().setExtraParam('table',parentTable[1]);
store.getProxy().setExtraParam('tab',parentTable[1]);
store.getProxy().setExtraParam('saving_table', table);
store.getProxy().setExtraParam('record_id',this.record_id);
this.store = store;
this.callParent(arguments);
store.load();


}



});


and here it's store


Ext.define('UserApp.store.LockFeature',{
extend: 'Ext.data.Store',
model: 'UserApp.model.LockFeature',
autoLoad: true,
pageSize: 20,
autoSync: true,
proxy: {
type: 'ajax',
api: {
read: 'organizations/list-lock',
create: 'organizations/insert-lock',
update: 'organizations/update-lock',
destroy: 'todo/delete-lock'
},
reader: {
type: 'json',
root: 'locks',
successProperty: 'success'
},
writer: {
type: 'json',
writeAllFields: true,
root: 'data'
}
},
listeners:{
write: function( store, operation, eOpts ){
store.load();
var response = Ext.JSON.decode(operation.response.responseText);
Ext.ux.Notification.notify(response.success?'Success':'Failure', response.message);
}
}
});


and the model


Ext.define('UserApp.model.LockFeature', {
extend: 'Ext.data.Model',
fields: [
'id', 'record_id', 'is_unreachable'
]
});


what is missing ??

girish.arjunagi
11 Mar 2013, 7:24 AM
You have assigned store as null to 'UserApp.view.uiTypes.LockFeature' panel. Try with the below code.

Ext.define('UserApp.view.uiTypes.LockFeature',{
extend: 'Ext.form.Panel',
collapsible: true,
flex: 1,
height: 200,
width: 600,
store: 'UserApp.store.LockFeature',

MohamedFawzy_
11 Mar 2013, 7:35 AM
i set it in initComponent function however i put your code but not working too

MohamedFawzy_
12 Mar 2013, 2:15 AM
any suggest ?