H
harry.viet
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.asp',
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(this.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,oRow) {
this.options.columns.eachSlice(1, function(columns) {
var oTd = document.createElement('td');
oRow.appendChild(oTd);
oTd.align = columns.pluck('align');
Cellfield =
columns.pluck('field').toString().toLowerCase();
Celltype =
columns.pluck('type').toString().toLowerCase();
Cellformat = columns.pluck('format');
CellText =
getXMLNodeValue(rootNode[nr].getElementsByTagName(Cellfield));
this.formatCell(CellText,CellType,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.asp',
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(this.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,oRow) {
this.options.columns.eachSlice(1, function(columns) {
var oTd = document.createElement('td');
oRow.appendChild(oTd);
oTd.align = columns.pluck('align');
Cellfield =
columns.pluck('field').toString().toLowerCase();
Celltype =
columns.pluck('type').toString().toLowerCase();
Cellformat = columns.pluck('format');
CellText =
getXMLNodeValue(rootNode[nr].getElementsByTagName(Cellfield));
this.formatCell(CellText,CellType,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?