PDA

View Full Version : Store not loading with local created data and in Grid-text box not comming



himanshu24
27 Sep 2012, 2:33 AM
Problem: I have a Grid 'A' which has some items with check box , once we click on the 'Customize' button on this page a new window 'custZoneName' will open containing a grid with 2 columns , 1st column being the old names and second columns being a text-box of the selected names.~o)

Issue1: why store11.on('load', function(){ is not giving me alert?
Issue2: Is reader required?
Issue 3: i am not able put text-box in the action-column !!will this work ? :((
Issue4: i have commented out the text-box part still data not coming do i have to leave grid and make a form element?
i have gone through row editing plugin that not what is required . he wanted an ability to rename all in one go.:-?
PFB the code:



function customiseZoneLabel() {
if (records.length > 0) {



// Getting the objects which are checked
var data11 = (function() {
var records11 = tree.getView().getChecked(), data11 = [];

Ext.Array.each(records11, function(rec) {
alert(rec.get('zoneId'));
data11.push({
zoneId : rec.get('zoneId'),
zoneNameOld : rec.get('name') ,
zoneNameNew : rec.get('name')
});
});
return data11;
})();


// Define our data model
Ext.define('CustZoneRequestModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'zoneId'},
{ name: 'zoneNameOld'},
{ name: 'zoneNameNew'}
],
idProperty: 'zoneId'
});

// Is this needed??
var myReader = new Ext.data.ArrayReader({}, [
{name: 'zoneNameOld'}]

);

// create the Data Store
var store11 = Ext.create('Ext.data.Store', {
// destroy the store if the grid is destroyed
autoDestroy: true,
model: 'CustZoneRequestModel',
proxy: {
type: 'memory'
},
data: data11,
reader: myReader // Is this needed??
});

// why not giving me alert??
store11.on('load', function(){
Ext.MessageBox.alert("hi");
alert(store11.getCount());
});

customiseZoneForm = Ext.create('Ext.grid.Panel', {
store: store11,
columnLines : true,
columns: [{
header: 'Current Zone Name',
dataIndex: 'zoneOldName',
// flex: 1,
sortable:false
}
// commented out as it was not working ??
/* ,
{
xtype : 'actioncolumn',
// header: 'New Zone Name',
colspan : 2,
// fieldLabel : 'New Zone Name',
allowBlank : false,
// disabled : true,
width:250,
items : [ {xtype : 'textfield'}]
} */],
width: 600,
height: 400,

frame: true});



zoneLabelWin = Ext.widget('window', {
title : '<spring:message code="label.zoneLabelWin"/>',
closeAction : 'destroy',
width : 800,
height : 800,
minHeight : 800,
layout : 'fit',
resizable : true,
modal : true,
items : customiseZoneForm
});


zoneLabelWin.show();}
}

mitchellsimoens
2 Oct 2012, 8:26 AM
The load event is not firing because you aren't loading the store. You are specifying inline data so there really isn't a need to listen for the load event.

himanshu24
2 Oct 2012, 11:03 AM
Accepted ..but even though store11.getCount() should return me data count in store right?