| Support Center

(Back to Website)

Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

numeric formatter in add and edit dialogs or inline editing during adding or editing

toki Mar 29, 2013 02:20PM PKT


$col["formatter"] = "number";

Yes, it works perfect in phpgrid for formatting numeric columns with thousandseparator and decimalseparator.

My question is that how is it possible to use numeric formatter in add and edit dialogs or online editing when during adding and editing?

Thank you very much.


Up 11 rated Down
Abu Ghufran Mar 29, 2013 11:36PM PKT PHP Grid - Support Center Engineer
Yes, you can have it, but you might need to pass the posted data through some filter. For e.g. on_insert and on_update, and make it compatible with database.

// when 3rd argument true, fnuction will act as a filter for data.
$e["on_update"] = array("update_filter", null, true);

function update_filter(&$data)
$data["params"]["num"] = str_replace(",","",$data["params"]["num"]);
Up 0 rated Down
toki Mar 30, 2013 02:55AM PKT
Hi Abu,

I tried but I could not.

what I tried to do ;

$opt["caption"] = "Clients Data";

## ------------------ ##
## ------------------ ##

// params are array(<function-name>,<class-object> or <null-if-global-func>,<continue-default-operation>)
// if you pass last argument as true, functions will act as a data filter, and insert/update will be performed by grid
$e["on_insert"] = array("add_client", null, false);
$e["on_update"] = array("update_client", null, false);

// ********* when 3rd argument true, fnuction will act as a filter for data.
$e["on_update"] = array("update_filter", null, true);

$e["on_delete"] = array("delete_client", null, true);
# $e["on_after_insert"] = array("after_insert", null, true); // return last inserted id for further working
$e["on_data_display"] = array("filter_display", null, true);

## ------------------ ##
## ------------------ ##
// just set the JS function name (should exist)
$e["js_on_select_row"] = "do_onselect"; // BAK BODY İÇİNDE BU FONKSİYON VAR....


// br=my DECIMAL column name, Is it true?

function update_filter($data)
$data["params"]["br"] = str_replace(",","",$data["params"]["br"]);

Can you help me please ?

Thank you
Up -1 rated Down
Abu Ghufran Apr 02, 2013 12:26AM PKT PHP Grid - Support Center Engineer
I have sent you a sample code for it.

$e["on_update"] = array("update_client", null, true);

function update_client($data)
$data["params"]["name"] = str_replace(",","",$data["params"]["name"]);

Your code also looks fine, but may need some debugging. You can put die() or echo calls in this event handler and check it via firefox->firebug->net->xhr call response.
Up -2 rated Down
toki Apr 06, 2013 03:05AM PKT
Hi Abu,

Thank you very much for your sample code. It gives me some idea. But I could not do it yet.

Thank you very much for your help.


Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Contact Us

  • Post a Public Question
  • Email Us
  • Live Chat!
  • Ask the Community


    • Paste complete code that is involved in your question. You can use pastebin.com to share code link.

    Screenshots or Online link of webpage is helpful in resolution. You can also send email at address mentioned below.

    • To report an issue, Write steps to regenerate the case.

    • For email support or live chat, Use gridphp@gmail.com and add it in Google Chat.
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found