PDA

View Full Version : store to jsonstore to get metadata



ramesan.rakesh
10 Dec 2009, 5:32 AM
i have an appplication where i need to get meta data from store.. to create the column header for my grid panel dynamically ...

i found the options to obtain column header in jsonstore but not in store ... is there any possiblity where i colud get the metadata from store or a way to convert my store to json store ....?
thanks

Arno.Nyhm
10 Dec 2009, 9:15 AM
there is no jsonstore :-(

maybe you post your existing code. and also your "normal" store in which you need something.

ramesan.rakesh
10 Dec 2009, 8:57 PM
thanks..
but i got the idea of jsonstore from this...
http://www.extjs.com/learn/Tutorial:Dynamic_Columns_in_a_Grid

this is my code,,

store


store= new Ext.data.Store({
proxy:new Ext.ux.data.DwrProxy({
dwrFunction: this.read,
listeners: {
beforeload: function(dataProxy, params) {
if(params.start){
params[dataProxy.loadArgsKey] = [params.start, params.limit];
}else{
params[dataProxy.loadArgsKey] = [0, 2];
}
if(params.argsArray){
params[dataProxy.loadArgsKey]=params[dataProxy.loadArgsKey].concat(params.argsArray);
}else{
if(initParams){
params[dataProxy.loadArgsKey]=params[dataProxy.loadArgsKey].concat(initParams);
}
}
}
}
}),
reader: new Ext.data.JsonReader({
root: 'claimedTasksList',
totalProperty: 'totalCount'},
Ext.data.Record.create(this.fields))
});

var config={
store : store,
tbar : [{
xtype:'paging',
store:store,
pageSize:2
}],
columns : this.coloumns
};



my grid panel..


var grid=new Rims.grid.PagingGridPanel({
height : 200,
width : 600,
renderTo : menuDiv,
enableCtxMenu: false, // turn off header context menu
menuDisabled: true, // turn off header context menu
enableColumnMove: false, // turn off column reorder drag drop
enableColumnResize: false, // turn off column resize for whole grid
initParams:['A'],

fields:[{name: 'wfManualTaskIncDetail.incidents.incId'},
{name: 'wfManualTaskIncDetail.incdId'},
{name: 'wfManualTaskIncDetail.incdEventType.evttName'},
{name:'wfManualTaskIncDetail.incdObjects.objHostIP'},
{name:'wfManualTaskIncDetail.incdCount'},
{name:'incdFirstOccrDateTime'}],
coloumns:[ {
header :'Incident'},{
header :'Child Incd ID',renderer:function(value,p,r){return (String.format("<a href='#'>{0}</a>",value)) }},{
header:'Event Type',renderer:function(value,p,r){return (value.length>5)?String.format("{0}{1}",value.substring(0,5),"..."):value}},{
header: 'IP'},{
header:'Count'},{
header:'First Occurence'}],
read:WFManualTaskBean.getClaimedTasksList,

});

ramesan.rakesh
10 Dec 2009, 8:59 PM
thanks..
but i got the idea of jsonstore from this...
http://www.extjs.com/learn/Tutorial:Dynamic_Columns_in_a_Grid

this is my code,,

store


store= new Ext.data.Store({
proxy:new Ext.ux.data.DwrProxy({
dwrFunction: this.read,
listeners: {
beforeload: function(dataProxy, params) {
if(params.start){
params[dataProxy.loadArgsKey] = [params.start, params.limit];
}else{
params[dataProxy.loadArgsKey] = [0, 2];
}
if(params.argsArray){
params[dataProxy.loadArgsKey]=params[dataProxy.loadArgsKey].concat(params.argsArray);
}else{
if(initParams){
params[dataProxy.loadArgsKey]=params[dataProxy.loadArgsKey].concat(initParams);
}
}
}
}
}),
reader: new Ext.data.JsonReader({
root: 'claimedTasksList',
totalProperty: 'totalCount'},
Ext.data.Record.create(this.fields))
});

var config={
store : store,
tbar : [{
xtype:'paging',
store:store,
pageSize:2
}],
columns : this.coloumns
};



my grid panel..

({
height : 200,
width : 600,
renderTo : menuDiv,
enableCtxMenu: false, // turn off header context menu
menuDisabled: true, // turn off header context menu
enableColumnMove: false, // turn off column reorder drag drop
enableColumnResize: false, // turn off column resize for whole grid
initParams:['A'],

fields:[{name: 'wfManualTaskIncDetail.incidents.incId'},
{name: 'wfManualTaskIncDetail.incdId'},
{name: 'wfManualTaskIncDetail.incdEventType.evttName'},
{name:'wfManualTaskIncDetail.incdObjects.objHostIP'},
{name:'wfManualTaskIncDetail.incdCount'},
{name:'incdFirstOccrDateTime'}],
coloumns:[ {
header :'Incident'},{
header :'Child Incd ID',renderer:function(value,p,r){return (String.format("<a href='#'>{0}</a>",value)) }},{
header:'Event Type',renderer:function(value,p,r){return (value.length>5)?String.format("{0}{1}",value.substring(0,5),"..."):value}},{
header: 'IP'},{
header:'Count'},{
header:'First Occurence'}],
read:WFManualTaskBean.getClaimedTasksList,

});

Arno.Nyhm
14 Dec 2009, 7:53 AM
you are in the wrong category. this is the gxt part not the extjs part. thats why you get not many answers... maybe a admin can move your thread.