-
Hi,
Your code for sorting works fine, thanks.
And for that column header thing, I am sending parameter to PHP like,
Code:
http://localhost/test/php/data.php?param1=id
So this id will form a query like,
Code:
SELECT id from table_name
and forms grid.
When I pass parameter (this will be done with a button click event) first time and forms grid and works fine, but when I am not sending parameter again (second click) like,
Code:
http://localhost/test/php/data.php?param1=
It has the previously added column in the grid with no data like I shown in the picture.
I think what you mentioned there as JSON response is right, since there is no id in second click, JSON is empty and not showing data, but can we have like when there is not parameter sent, grid shouldn't form?
-
I did it myself in the controller,
Code:
Ext.get('grid_id').hide();
Hiding the entire grid when not necessary. And thanks for your plugin, this helped me in a great way.
-
I created for you more complex soluction that is more elastic I think.
Look into github last commit:
https://github.com/nonameplum/Dynami...42bea62c775c02
But hiding grid is good too.
I was thought that this will require changes in dynamicGrid or dynamicReader class but not, it could be easly done in e.g. controller.
I'm glad I could help.
Best regards.
-
Hi,
That worked good, thanks, you need to add,
Code:
dynamicGrid.getStore().removeAll();
also to remove data also from the grid, thanks for your help.
Can we integrate,
https://market.sencha.com/users/68/extensions/95
this too in your plugin?
-
No problem, feel free to use.
-
If you don't mind can you tell me where I have to add Filter plugin? Because your plugin creates dataIndex and columns dynamically, but that plugin needs it to be given it in the static grid :-/.
-
You have to look to filter plugin code, how it works (I have never used this plugin), but probably you have to create plugin dynamically in reconfigure dynamicGrid's event -> http://docs.sencha.com/ext-js/4-1/#!...nt-reconfigure
-
I would also love to see this work in SA2!
Anyone had any success yet?
:((
-
Hi iamiebie,
Still couldn't find a way to use plugins in SA, if someone knows how, please enlighten us, that would be of great help.
I would love to have pagingtoolbar in this plugin, tried like in,
http://docs.sencha.com/ext-js/4-1/#!...toolbar.Paging
But not getting it right, please help!
-
I did the following changes in DynamicGrid to get pagingtoolbar,
Code:
Ext.define('Ext.ux.grid.DynamicGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.dynamicGrid',
alternateClassName: 'Ext.grid.DynamicGrid',
requires: [
'Ext.ux.data.reader.DynamicReader'
],
// URL used for request to the server. Required
url: '',
initComponent: function() {
console.log('DynamicGrid initComponent!');
var me = this;
if (me.url == '') {
Ext.Error.raise('url parameter is empty! You have to set proper url to get data form server.');
}
else {
var DynamicGrid = Ext.applyIf(me, {
columns: [],
forceFit: false,
store: Ext.create('Ext.data.Store', {
// Fields have to be set as empty array. Without this Ext will not create dynamic model.
fields: [],
// After loading data grid have to reconfigure columns with dynamic created columns
// in Ext.ux.data.reader.DynamicReader
listeners: {
'metachange': function(store, meta) {
me.reconfigure(store, meta.columns);
}
},
autoLoad: true,
pageSize: 10,
remoteSort: false,
remoteFilter: false,
remoteGroup: false,
proxy: {
reader: 'dynamicReader',
type: 'rest',
url: me.url
}
})
});
}
me.bbar = Ext.create('Ext.PagingToolbar', {
store: me.store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
});
me.callParent(arguments);
}
});
Initially it shows 1 of 2 pages and all, but it forms grid with all data in all page.
Where should I set totalProperty?