PDA

View Full Version : Ext.ux.touch.grid.View in MVC app



tino7_03
16 Jan 2012, 3:01 AM
I have this problem when I use Ext.ux.touch.grid.View in MVC app.
I have a view like this:



Ext.define('GpMobile.view.Customers', {
extend: 'Ext.Panel',
alias : 'widget.customers',
config:{
fullscreen:true,
items:[
{ xtype:'touchgridpanel',
store : null,
features : [
{ ftype : 'Ext.ux.touch.grid.feature.Paging',
launchFn : 'initialize'
},
{ ftype : 'Ext.ux.touch.grid.feature.Sorter',
launchFn : 'initialize'
}
],
columns : [
{ header : 'Ragione sociale',
dataIndex : 'an_descr1',
width : '100%'
}
]
}
]
}
});


If I write in the views.js file an alert like this:



initialize: function() {
var me = this;
alert(me._columns);
me.header = me.buildHeader();
if (typeof me.initFeatures === 'function' && typeof me.features === 'object') {
me.initFeatures(me.features, 'initialize');
}
me.callParent(arguments);
me.header.setHtml(me._buildTpl(me.getColumns(), true));
},

the execution returns an empty message, but if I use the same alert when I use a not MVC app the alert returns an object (the grid columns).
This scenario creates problems if I want get columns from a custom feature and I don't understant how I can to solve.
Thanks in advance for the help, it's very important issue for me.

P.S.: In my example the store is null, because it has not effects about this problem.

mitchellsimoens
16 Jan 2012, 6:23 AM
I tried this and it worked with no problems:


Ext.define('GpMobile.view.Customers', {
extend: 'Ext.Panel',
alias : 'widget.customers',
config:{
fullscreen:true,
layout : 'fit',
items:[
{
xtype:'touchgridpanel',
store : null,
features : [
{
ftype : 'Ext.ux.touch.grid.feature.Paging',
launchFn : 'initialize'
},
{
ftype : 'Ext.ux.touch.grid.feature.Sorter',
launchFn : 'initialize'
}
],
columns : [
{
header : 'Ragione sociale',
dataIndex : 'an_descr1',
width : '100%'
}
]
}
]
}
});

All I did was clean your code up (spacing) and add layout : 'fit'. The column header showed just fine.

tino7_03
16 Jan 2012, 6:47 AM
Thanks very mutch for your reply. It's very important for me to solve this problem because it is stopping my project.
In my case aslo there are not problem with column header. I can see it, but the "me._columns" is empty in "initialize" function of views.js. If I use the grid in a no MVC project the "me.columns" is full with columns data.
The problem is not the screen output but I'd need the "me.columns" not empty for to build my plugin, because in "init" function of my plugin the "grid.getColumns" returns an empty result (only in mvc project).
Why are there two different situations if the app is or not is an MVC project?

I need help very mutch....
Thanks again.

mitchellsimoens
16 Jan 2012, 6:50 AM
try the getter...


me.getColumns()

Stuff in the config object, you shouldn't reference by the property but by the getter.

tino7_03
16 Jan 2012, 7:00 AM
I've tryed the first time, but with empty result. So, after I have used "me._column" but with the same result. I've tryed again now, but empty result always...


and the "grid.getColumns" in the "init" function of my plugin is in the same situation. My plugin works if not used in MVC app because grid.getColumns returns all columns.