473,387 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to send collection of parameters as options to an format function

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,Cellf ield,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?
Jun 27 '08 #1
3 1300
On 5 Jun., 12:24, harry.v...@gmail.com wrote:
I use the prototype library
My sincere condolences.
and create a class
There are no classes there.
that builds a grid using some parameters as mentioned below.
Everything is working but only the parameters for Number formatting

var gridopts = {
[...]
columns : [{
[...]
}]
}

With the syntax Object.extend(this.options, options || {}) in the grid
class I got all the parameter.
Your posted code does not contain a definition of the `options'
identifier. However, as both the object referred to by `gridopts' and
the object referred to by `this.options' appear to have a `columns'
property, I will assume

this.options = gridopts;

in the following.
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) {
[...]
Cellformat = columns.pluck('format');
[...]

this.formatCell(CellText,CellType,Cellformat,Cellf ield,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'
Your problem is caused by an improper use of or a bug in the
Prototype.js API, particularly one or more of the augmented (not built-
in) Object.extend(), this.options.columns.eachSlice ===
Array.prototype.eachSlice, columns.pluck === Array.prototype.pluck,
and Function.prototype.bind() methods.
Could anybody give me a hint?
The Prototype.js support area is over there --http://prototypejs.org/
Ceterum censeo Prototype.js esse delendam.

PointedEars
Jun 27 '08 #2
Hello Harry,

Please post your question on the Prototype user list:
http://groups-beta.google.com/group/...rails-spinoffs

You may need to post more code snippets or an example html file as
well :).

- JDD
Jun 27 '08 #3
jdalton wrote:
Hello Harry,
Don't call me Jer^W Harry.[tm]
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James S | last post by:
Hi, Basically I've been fighting with this code for a few days now and can't seem to work around this problem. Included is the output, the program I use to get this error and the source code for...
6
by: simon | last post by:
Always when I need data reader in my programs, I simply have functions, which creates it for me: Dim rdr As SqlDataReader dim sql as string sql="myStoredProcedure" rdr =...
15
by: Steve Horrillo | last post by:
I can't figure out why this script won't insert the subject in the email and why can't I control the font and size being used? I'm not sure where to post this. Let me know where if this is OT. ...
5
by: Kurt Bauer | last post by:
I have an ASP group calendar application which pulls calendar data from Exchange via webdav into an XML string. I then loop the XML nodes to populate a collection of appointments. Finally I use...
2
by: Fatih BOY | last post by:
Hi, I want to send a report from a windows application to a web page like 'report.asp' Currently i can send it via post method with a context like local=En&Username=fatih&UserId=45&Firm=none...
2
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a...
9
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
12
by: neovantage | last post by:
Hi, I am working on an image to process it with different ways/options given in the page. My page name is cart and it has an uploaded image having thumbnail view. When i click on that thumbnail...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.