Valetudo
19 Nov 2009, 12:33 PM
Hi!
This grid fire a "form.getAttribute is not a function" error message when i hit the update button.
/*Ext JS Library 3.0.3*/
ext-all-debug.js (line 36200)
if (this.fireEvent('beforecall', this, t) !== false) {
Ext.Direct.addTransaction(t);
var isUpload = String(form.getAttribute("enctype")).toLowerCase() == 'multipart/form-data',
Shop.Types.GridDatas = Ext.extend(Ext.grid.GridPanel, {
title: 'Multi Language Datas',
margins: '0 5 5 5',
viewConfig: {
autoFill: true
},
stripeRows: true,
initComponent: function () {
var writer = new Ext.data.JsonWriter({
encode: false
});
var ds = new Ext.data.DirectStore({
api: {
read: Type.Details,
create: Type.Create,
destroy: Type.Delete,
update: Type.Update
},
writer: writer,
paramsAsHash: true,
paramOrder: 'id',
baseParams: {
id: 0
},
root: 'data',
idProperty: 'Id',
totalProperty: 'total',
fields: [{
name: 'typed_id',
type: 'int'
},
{
name: 'lang_id',
type: 'int',
mapping: 'lang_id'
},
{
name: 'language',
type: 'string',
mapping: 'language.language_short'
},
{
name: 'type_name',
type: 'string'
},
{
name: 'type_name_flural',
type: 'string'
}],
remoteSort: false
});
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var config = {
store: ds,
plugins: [editor],
autoExpandColumn: 'blank',
columns: [
new Ext.grid.RowNumberer(), {
header: 'Language',
dataIndex: 'language',
width: 85,
align: 'center'
},
{
header: 'Name',
dataIndex: 'type_name',
width: 200,
editor: {
xtype: 'textfield',
allowBlank: false
}
},
{
header: 'Name Flural',
dataIndex: 'type_name_flural',
width: 200,
editor: {
xtype: 'textfield',
allowBlank: false
}
},
{
id: 'blank',
dataIndex: ''
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Shop.Types.GridDatas.superclass.initComponent.apply(this, arguments);
},
loadDatas: function (id) {
this.getStore().setBaseParam('id', id);
this.getStore().reload();
Shop.Types.GridDatas.superclass.afterRender.apply(this, arguments);
}
});
With this code -> console : "create",.....
api: {
read: Type.Details,
create: function (params, proxy) {
console.log("create", params);
},
destroy: Type.Delete,
update: function (params, proxy) {
console.log("update", params);
}
}
What is wrong with my code?
Sorry for my English!
Thx!
This grid fire a "form.getAttribute is not a function" error message when i hit the update button.
/*Ext JS Library 3.0.3*/
ext-all-debug.js (line 36200)
if (this.fireEvent('beforecall', this, t) !== false) {
Ext.Direct.addTransaction(t);
var isUpload = String(form.getAttribute("enctype")).toLowerCase() == 'multipart/form-data',
Shop.Types.GridDatas = Ext.extend(Ext.grid.GridPanel, {
title: 'Multi Language Datas',
margins: '0 5 5 5',
viewConfig: {
autoFill: true
},
stripeRows: true,
initComponent: function () {
var writer = new Ext.data.JsonWriter({
encode: false
});
var ds = new Ext.data.DirectStore({
api: {
read: Type.Details,
create: Type.Create,
destroy: Type.Delete,
update: Type.Update
},
writer: writer,
paramsAsHash: true,
paramOrder: 'id',
baseParams: {
id: 0
},
root: 'data',
idProperty: 'Id',
totalProperty: 'total',
fields: [{
name: 'typed_id',
type: 'int'
},
{
name: 'lang_id',
type: 'int',
mapping: 'lang_id'
},
{
name: 'language',
type: 'string',
mapping: 'language.language_short'
},
{
name: 'type_name',
type: 'string'
},
{
name: 'type_name_flural',
type: 'string'
}],
remoteSort: false
});
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var config = {
store: ds,
plugins: [editor],
autoExpandColumn: 'blank',
columns: [
new Ext.grid.RowNumberer(), {
header: 'Language',
dataIndex: 'language',
width: 85,
align: 'center'
},
{
header: 'Name',
dataIndex: 'type_name',
width: 200,
editor: {
xtype: 'textfield',
allowBlank: false
}
},
{
header: 'Name Flural',
dataIndex: 'type_name_flural',
width: 200,
editor: {
xtype: 'textfield',
allowBlank: false
}
},
{
id: 'blank',
dataIndex: ''
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Shop.Types.GridDatas.superclass.initComponent.apply(this, arguments);
},
loadDatas: function (id) {
this.getStore().setBaseParam('id', id);
this.getStore().reload();
Shop.Types.GridDatas.superclass.afterRender.apply(this, arguments);
}
});
With this code -> console : "create",.....
api: {
read: Type.Details,
create: function (params, proxy) {
console.log("create", params);
},
destroy: Type.Delete,
update: function (params, proxy) {
console.log("update", params);
}
}
What is wrong with my code?
Sorry for my English!
Thx!