PDA

View Full Version : Ext.ux.grid.DynamicGridPanel



zeus2615
8 Jun 2013, 6:06 PM
I use the following code (from this forum perhaps) to generate dynamicgridpanel from json data. It works quite well with only a small problem. This grid cann't works with Ext.grid.plugin.RowEditing. The second time render a grid will cause warning"Attempted to remove a component that does not exist. Ext.container.Container: remove takes an argument of the component to remove. cmp.remove() is incorrect usage.", And then click on a rowediting doesn't render correctly. The editor width is out of expected.
I tried to fix it out all day, but failed.
Maybe someone can help me out of problem.


44252


JSON:


{"columns":[{"dataIndex":"values[0].value","editor":{"format":"Y-m-d h:i:s","xtype":"datefield"},"flex":0,"format":"Y-m-d h:i:s","header":"dateDis","sortable":false,"xtype":"datecolumn"},{"dataIndex":"values[1].value","editor":{"displayField":"name","editable":false,"forc eSelection":true,"store":{"data":[{"name":"A","value":"A"},{"name":"B","value":"B"},{"name":"C","value":"C"}],"fields":["name","value"],"xtype":"store"},"valueField":"value","xtype":"combo"},"flex":1,"header":"fire","sortable":false},{"dataIndex":"values[2].value","editor ":{"displayField":"name","editable":false,"forceSelection":true,"store":{"data":[{"name":"yes","value":"true"},{"name":"no","value":"false"}],"fields":["name","value"],"xtype":"store"},"valueField":"value","xtype":"combo"},"flex":0,"header":"kill","sortable":false},{"data Index":"deleted","editor":{"displayField":"name","editable":false,"forceSelection":true,"store":{"data":[{"name":"yes","value":"true"},{"name":"no","value":"false"}],"fields":["name","value"],"xtype":"store"},"valueField":"value","xtype":"combo"},"flex":0,"header":"ifdele ted","sortable":false}],"data":[],"message":"operation success","metaData":{"fields":[{"allowBlank":false,"defaultValue":"0","name":"id","type":"int"},{"allowBlank":false,"defaultValue":"0","name":"tableId","type":"int"},{"allowBlank":false,"defaultValue":"","name":"delet ed","type":"string"},{"allowBlank":false,"defaultValue":null,"name":"createTime","type":"date"},{"allowBlank":false,"defaultValue":null,"name":"modifyTime","type":"date"},{"allowBlank":false,"defaultValue":null,"name":"values[0].value","type":"date"},{"allowBlank":false," defaultValue":null,"name":"values[0].fieldId","type":"int"},{"allowBlank":false,"defaultValue":null,"name":"values[0].recordId","type":"int"},{"allowBlank":false,"defaultValue":null,"name":"values[1].value","type":"auto"},{"allowBlank":false,"defaultValue":null,"name":"va lues[1].fieldId","type":"int"},{"allowBlank":false,"defaultValue":null,"name":"values[1].recordId","type":"int"},{"allowBlank":false,"defaultValue":null,"name":"values[2].value","type":"boolean"},{"allowBlank":false,"defaultValue":null,"name":"values[2].fieldId","type":"i nt"},{"allowBlank":false,"defaultValue":null,"name":"values[2].recordId","type":"int"}],"idProperty":"id","root":"data","successProperty":"success","totalProperty":"total"},"success":true,"total":0}


model:


Ext.define('Test.model.RecordGrid', {
extend: 'Ext.data.Model'
});


store:


Ext.define('Test.store.RecordGridStore', {
extend: 'Ext.data.Store',
model: 'Test.model.RecordGrid',
autoLoad: false,
pageSize: 10,
proxy: {
type: 'ajax',
url: './app/data/edit.json'
}
});


Grid:


Ext.define('Test.view.record.RecordGrid', {
requires: [
'Test.store.RecordGridStore'
],
extend: 'Ext.ux.grid.DynamicGridPanel',
alias: 'widget.test.record.recordgrid',
layout: 'fit',
store: 'RecordGridStore',
plugins: [Ext.create('Ext.grid.plugin.RowEditing', {
autoCancel: false,
clicksToMoveEditor: 1
})],
dockedItems: [{
xtype: 'pagingtoolbar',
store: 'RecordGridStore',
dock: 'bottom',
displayInfo: true
}]
});

slemmon
10 Jun 2013, 12:16 PM
I'm not familiar with the user extension: Ext.ux.DynamicGridPanel

Perhaps post your question in the User Extension forum or even against the post announcing the user extension (though I wasn't able to find such a thread specifically when I searched just now).