PDA

View Full Version : what to include for Row editing



Jvn
28 Aug 2012, 11:05 PM
Hi ,

I am very new to extjs.

What styles and script files need to include for row editing .

suppose i copied the code from sencha and pasted with in the <script> tag . but i need to call that script . where to call and how to call can any one help to me.

tsuryap
28 Aug 2012, 11:35 PM
Hi,

paste your code in separate js file and inculde it in your html or jsp using script tag ........

and your code should be enclosed in Ext.onReady(function(){
your code................
});
Now run your html file....sorry for bad english...

scottmartin
29 Aug 2012, 12:47 PM
It is as simple as this:



Ext.create('Ext.data.Store', {
storeId : 'simpsonsStore',
fields : ['name', 'email', 'change'],
data : {'items' : [
{ 'name' : 'Lisa', 'email' : 'lisa@simpsons.com', 'change' : 100 },
{ 'name' : 'Bart', 'email' : 'bart@simpsons.com', 'change' : -20 },
{ 'name' : 'Homer', 'email' : 'home@simpsons.com', 'change' : 23 },
{ 'name' : 'Marge', 'email' : 'marge@simpsons.com', 'change' : -11 }
]},
proxy : {
type : 'memory',
reader : {
type : 'json',
root : 'items'
}
}
});

var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToMoveEditor: 1,
autoCancel: false
});

Ext.create('Ext.grid.Panel', {
title : 'Simpsons',
store : Ext.data.StoreManager.lookup('simpsonsStore'),
columns : [
{ header : 'Name', dataIndex : 'name', editor: { xtype: 'textfield' } },
{ header : 'Email', dataIndex : 'email', flex : 1, editor: { xtype: 'textfield' } },
{ header : 'Change', dataIndex : 'change', editor: { xtype: 'numberfield' } }
],
height : 200,
width : 400,
renderTo : Ext.getBody(),

plugins: [ rowEditing ]
});?


Scott.