Some generic questions

QuestionsSome generic questions
Fabio Martins asked 10 years ago

Hi all,

Please I have 3 doubts in phpgrid:

1) How can I sort my table (on grid load) by 2 or more columns?

2) How can I format numbers to display o,oo (to zero values), 1.111,11 (to positive numbers) and (1.111,11) (to negative numbers). In my VB grid I use, for example:
col.DataFormatString = "{0:#,##0.00; (#,##0.00); #.##}"
To zero, negative and positive numbers, in this order.

3) In add and edit buttons I can use my jqueyui dialogs? Have you a example?

Thank you!
Fábio Martins

1 Answers
Abu Ghufran answered 10 years ago


2) For display formatting, you can simply set

$col["formatter"] = "number";
$col["formatoptions"] = array("thousandsSeparator" => ",",
"decimalSeparator" => ".",
"decimalPlaces" => 2);

And for input boxes, you can check following faq entry.

Q) How to mask a field, for example like this: (NN) NNNN-NNNN ? N stands for number.

You can however, pick input jquery id selectors, and linking them using any lib.

for e.g.

Most likely, you would need to code it after show form event. for e.g. if ID of element id "date"

$grid["add_options"]["afterShowForm"] = 'function(formid) { jQuery("#total").mask("0,000.00"); }';
$grid["edit_options"]["afterShowForm"] = 'function(formid) { jQuery("#tatal").mask("0,000.00"); }';

3) You can have custom toolbar buttons (demos/appearence/toolbar-button) and in onclick event, call you jqdialog code.

Your Answer

4 + 0 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?