ravi123
4 Jun 2008, 4:59 AM
Need Help for Read Grid data in to server Request
my code is
/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
var PresidentsDataStore; // this will be our datastore
var PresidentsColumnModel; // this will be our columnmodel
var PresidentListingEditorGrid;
var PresidentListingWindow;
Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
var myData = [
['1','']
];
var LocationBlank = Ext.data.Record.create([
{name: 'intLoctionID', type: 'int'},
{name: 'vchCity', type: 'string'}
]);
// create the data store
PresidentsDataStore = new Ext.data.SimpleStore({
fields: [
{name: 'intLoctionID'},
{name: 'vchCity'}
]
});
PresidentsDataStore.loadData(myData);
// Create Coloum Mode
PresidentsColumnModel=new Ext.grid.ColumnModel(
[
{
header: '#',
dataIndex: 'intLoctionID',
width: 15
},
{
header: 'City',
dataIndex: 'vchCity',
width: 150,
editor: new Ext.form.TextField({
allowBlank: false,
maxLength: 20,
maskRe: /([a-zA-Z0-9\s]+)$/
})
}]
);
PresidentsColumnModel.defaultSortable= true;
// create the Grid
PresidentListingEditorGrid = new Ext.grid.EditorGridPanel({
id: 'PresidentListingEditorGrid',
store: PresidentsDataStore, // the datastore is defined here
cm: PresidentsColumnModel, // the columnmodel is defined here
enableColLock:false,
clicksToEdit:1,
height:200,
selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
tbar:[{
text:'Add Location',
tooltip:'Add a new Location',
iconCls:'add',
handler : function(){
var p = new LocationBlank({
intLoctionID:PresidentsDataStore.getCount()+1,
vchCity:''
});
PresidentListingEditorGrid.stopEditing();
// Ext.MessageBox.alert('Message',PresidentsDataStore.getCount());
PresidentsDataStore.insert(PresidentsDataStore.getCount(), p);
PresidentListingEditorGrid.startEditing(1, 0);
}
},'-',{
text:'Remove LocationAccount',
tooltip:'Remove the selected bank account',
iconCls:'remove',
handler: handleDelete //what happens when user clicks on it
}]
});
function handleDelete() {
var selectedKeys = PresidentListingEditorGrid.selModel.selections.keys; //returns array of selected rows ids only
if(selectedKeys.length > 0) {
var row=PresidentListingEditorGrid.getSelectionModel().getSelected().data['intLoctionID']
PresidentsDataStore.remove(PresidentListingEditorGrid.getSelectionModel().getSelected());
// Ext.MessageBox.alert('Message',row );
}else{
Ext.MessageBox.alert('Message','Please select at least one item to delete');
}
};
PresidentListingEditorGrid.render('gridlocation');
});
i read this grid data from server request i get only end row data value ...
any body help for get all value in server request .
i want to save all data only after save button click.
above code is work fine..
just i need get that gird datas..
my code is
/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
var PresidentsDataStore; // this will be our datastore
var PresidentsColumnModel; // this will be our columnmodel
var PresidentListingEditorGrid;
var PresidentListingWindow;
Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
var myData = [
['1','']
];
var LocationBlank = Ext.data.Record.create([
{name: 'intLoctionID', type: 'int'},
{name: 'vchCity', type: 'string'}
]);
// create the data store
PresidentsDataStore = new Ext.data.SimpleStore({
fields: [
{name: 'intLoctionID'},
{name: 'vchCity'}
]
});
PresidentsDataStore.loadData(myData);
// Create Coloum Mode
PresidentsColumnModel=new Ext.grid.ColumnModel(
[
{
header: '#',
dataIndex: 'intLoctionID',
width: 15
},
{
header: 'City',
dataIndex: 'vchCity',
width: 150,
editor: new Ext.form.TextField({
allowBlank: false,
maxLength: 20,
maskRe: /([a-zA-Z0-9\s]+)$/
})
}]
);
PresidentsColumnModel.defaultSortable= true;
// create the Grid
PresidentListingEditorGrid = new Ext.grid.EditorGridPanel({
id: 'PresidentListingEditorGrid',
store: PresidentsDataStore, // the datastore is defined here
cm: PresidentsColumnModel, // the columnmodel is defined here
enableColLock:false,
clicksToEdit:1,
height:200,
selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
tbar:[{
text:'Add Location',
tooltip:'Add a new Location',
iconCls:'add',
handler : function(){
var p = new LocationBlank({
intLoctionID:PresidentsDataStore.getCount()+1,
vchCity:''
});
PresidentListingEditorGrid.stopEditing();
// Ext.MessageBox.alert('Message',PresidentsDataStore.getCount());
PresidentsDataStore.insert(PresidentsDataStore.getCount(), p);
PresidentListingEditorGrid.startEditing(1, 0);
}
},'-',{
text:'Remove LocationAccount',
tooltip:'Remove the selected bank account',
iconCls:'remove',
handler: handleDelete //what happens when user clicks on it
}]
});
function handleDelete() {
var selectedKeys = PresidentListingEditorGrid.selModel.selections.keys; //returns array of selected rows ids only
if(selectedKeys.length > 0) {
var row=PresidentListingEditorGrid.getSelectionModel().getSelected().data['intLoctionID']
PresidentsDataStore.remove(PresidentListingEditorGrid.getSelectionModel().getSelected());
// Ext.MessageBox.alert('Message',row );
}else{
Ext.MessageBox.alert('Message','Please select at least one item to delete');
}
};
PresidentListingEditorGrid.render('gridlocation');
});
i read this grid data from server request i get only end row data value ...
any body help for get all value in server request .
i want to save all data only after save button click.
above code is work fine..
just i need get that gird datas..