I use the prototype library and create a class that builds a grid
using some parameters as mentioned below.
Everything is working but only the parameters for Number formatting
var gridopts = {
iPageSize : 100,
dataSource : '../data/ledgergetdata.a sp',
dataPars : { acct_type : '2' },
columns : [{ name: 'nummer', field : 'acctnr' , width:
'10%' , align: 'left', type: 'str', filter: true },
{ name: 'description', field : 'desc', width: '60%' ,
align: 'left', type: 'str', filter: true },
{ name: 'debit', field : 'debit', width: '10%' , align:
'right', type: 'num', format: [{ShowZero:false ,DecPlaces:
2}] },
{ name: 'credit', field : 'credit', width: '10%' ,
align: 'right', type: 'num' },
{ name: 'balance', field : 'balance', width: '10%' ,
align: 'right', type: 'num', format: [{ShowZero:true, DecPlaces:2}] }]
}
With the syntax Object.extend(t his.options, options || {}) in the grid
class I got all the parameter.
Soo far no problem.
When I create the tablecells in my grid class there is a function
like:
createCells: function(nr,oRo w) {
this.options.co lumns.eachSlice (1, function(column s) {
var oTd = document.create Element('td');
oRow.appendChil d(oTd);
oTd.align = columns.pluck(' align');
Cellfield =
columns.pluck(' field').toStrin g().toLowerCase ();
Celltype =
columns.pluck(' type').toString ().toLowerCase( );
Cellformat = columns.pluck(' format');
CellText =
getXMLNodeValue (rootNode[nr].getElementsByT agName(Cellfiel d));
this.formatCell (CellText,CellT ype,Cellformat, Cellfield,oTd);
}.bind(this))
},
The problem:
I should expect that the var Cellformat contains the array like
[{ShowZero:false ,DecPlaces:2}]
I would send this to the this.formatCell function to use it as
parameters to create the format to display.
The var Cellformat gives 'undefined'
Could anybody give me a hint?
using some parameters as mentioned below.
Everything is working but only the parameters for Number formatting
var gridopts = {
iPageSize : 100,
dataSource : '../data/ledgergetdata.a sp',
dataPars : { acct_type : '2' },
columns : [{ name: 'nummer', field : 'acctnr' , width:
'10%' , align: 'left', type: 'str', filter: true },
{ name: 'description', field : 'desc', width: '60%' ,
align: 'left', type: 'str', filter: true },
{ name: 'debit', field : 'debit', width: '10%' , align:
'right', type: 'num', format: [{ShowZero:false ,DecPlaces:
2}] },
{ name: 'credit', field : 'credit', width: '10%' ,
align: 'right', type: 'num' },
{ name: 'balance', field : 'balance', width: '10%' ,
align: 'right', type: 'num', format: [{ShowZero:true, DecPlaces:2}] }]
}
With the syntax Object.extend(t his.options, options || {}) in the grid
class I got all the parameter.
Soo far no problem.
When I create the tablecells in my grid class there is a function
like:
createCells: function(nr,oRo w) {
this.options.co lumns.eachSlice (1, function(column s) {
var oTd = document.create Element('td');
oRow.appendChil d(oTd);
oTd.align = columns.pluck(' align');
Cellfield =
columns.pluck(' field').toStrin g().toLowerCase ();
Celltype =
columns.pluck(' type').toString ().toLowerCase( );
Cellformat = columns.pluck(' format');
CellText =
getXMLNodeValue (rootNode[nr].getElementsByT agName(Cellfiel d));
this.formatCell (CellText,CellT ype,Cellformat, Cellfield,oTd);
}.bind(this))
},
The problem:
I should expect that the var Cellformat contains the array like
[{ShowZero:false ,DecPlaces:2}]
I would send this to the this.formatCell function to use it as
parameters to create the format to display.
The var Cellformat gives 'undefined'
Could anybody give me a hint?
Comment