Hello. I need help.
I have grid with toolbar when i create new grid with data (open window of create via button in toolbar)
the new row not displayed only after reloading the page i see the new row.
Thank you.
Creating item:
Dynamically load data to grid.
I have grid with toolbar when i create new grid with data (open window of create via button in toolbar)
the new row not displayed only after reloading the page i see the new row.
Thank you.
the store:
Code:
var writer = new Ext.data.JsonWriter({
type: 'json',
encode: false,
listful: true,
writeAllFields: true,
returnJson: true
});
var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'Id',
root: 'Data',
messageProperty: 'message'
});
var proxy = new Ext.data.HttpProxy({
reader: reader,
writer: writer,
type: 'ajax',
api: {
read: '/Item/Get',
create: '/Cart/CreateCart',
update: '/Cart/CreateCart',
destroy: '/Cart/CreateCart',
add: '/Cart/CreateCart'
},
headers: {
'Content-Type': 'application/json; charset=UTF-8'
}
});
Ext.define('ExtMVC.store.Items', {
extend: 'Ext.data.Store',
model: 'ExtMVC.model.Item',
autoLoad: true,
paramsAsHash: true,
autoSync: true,
proxy: proxy
});
Creating item:
Code:
additem: function (button) {
var win = button.up('window'),
form = win.down('form'),
values = form.getValues();
Ext.Ajax.request({
url: 'Item/CreateItem',
params: values,
success: function (response, options) {
var data = Ext.decode(response.responseText);
if (data.success) {
Ext.Msg.alert('Create', data.message);
}
else {
Ext.Msg.alert('Create', 'Creating is faild');
}
win.close();
}
});
}
Dynamically load data to grid.
Aucun commentaire:
Enregistrer un commentaire