Hi,
$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.
Regars…
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"]);
}
Hi Abu,
I tried but I could not.
what I tried to do ;
$opt["caption"] = "Clients Data";
$g->set_options($opt);
## —————— ##
## SERVER SIDE EVENTS ##
## —————— ##
// 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);
## —————— ##
## CLIENT SIDE EVENTS ##
## —————— ##
// just set the JS function name (should exist)
$e["js_on_select_row"] = "do_onselect"; // BAK BODY İÇİNDE BU FONKSİYON VAR….
$g->set_events($e);
// 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
I have sent you a sample code for it.
$e["on_update"] = array("update_client", null, true);
$grid->set_events($e);
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.
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.
Regards.