Hello everybody,
I would like to know how to add JS Event handler to my datagrid on rowSelected.
So I can perform other actions based on the selected row / ID
Refer demos/editing/custom-events.
$e["js_on_select_row"] = "do_onselect";
$grid->set_events($e);
and in html part …
<script>
function do_onselect(id)
{
alert('Simulating, on select row event')
var rd = jQuery('#list1').jqGrid('getCell', id, 'company'); // where invdate is column name
jQuery("#span_extra").html(rd);
}
</script>
Hi,
The same example.
But, I want to 'campany' field into my subgrid.
how can I do it?
Thank a lot of.
Hello,
In master grid, you need to define:
// comma sep. fields. will be POSTED from parent grid to subgrid, can be fetching using $_POST in subgrid
$opt["subgridparams"] = "company";
$grid->set_options($opt);
And in detail grid page, you can read it with:
$comp = $_REQUEST["company"];
Sorry I tray to explain again.The same
Refer demos/editing/custom-events.
$e["js_on_select_row"] = "do_onselect";
$grid->set_events($e);
and in html part …
<script>
function do_onselect(id)
{
alert('Simulating, on select row event')
var rd = jQuery('#list1').jqGrid('getCell', id, 'company'); // where invdate is column name
jQuery("#span_extra").html(rd);
}
</script>
but I want to
<script>
function do_onselect(id)
{
alert('Simulating, on select row event')
var rd = jQuery('#list1').jqGrid('getCell', id, 'company'); // where invdate is column name
jQuery("#span_extra").html(rd);
…
when I do to click in the sub grid, I want to information the 'campany2'
var rd = jQuery('#subgri1').jqGrid('getCell', id, 'company2'); // where invdate is column name
jQuery("#span_extra").html(rd);
}
</script>
Instead of #subgrid1 use #<?php echo $g->id?>
function do_onselect(id)
{
alert('Simulating, on select row event')
var rd = jQuery('#<?php echo $g->id?>').jqGrid('getCell', id, 'company2');
jQuery("#span_extra").html(rd);
}
</script>
Does not work!
When I use alert(rd) the answer is "false" and I use alert(id) the answer is rowid information, it is ok.
I've emailed you lib update. Please update.
Also confirm by alerting
alert('<?php echo $g->id?>');
and make sure company2 is your column name of subgrid.
alert('<?php echo $g->id?>');
it show blank, nothing.
I have to phpgrid-full-v1.4.8.2
Is it necessary the new version?
thank you, again.
Yes, it is added in newer version.
Just override the emailed file jqgrid_dist.php in lib/inc.
does not work!
function do_onselectAcceSub(id)
{
alert('Simulating, on select row event')
var rd = jQuery('#<?php echo $g->id?>').jqGrid('getCell', id, 'codigo_familiaE');
jQuery("#span_extra").html(rd);
alert('<?php echo $g->id?>');
alert('rowid '+id);
}
This alert('<?php echo $g->id?>'); show blank, nothing.
This alert('rowid '+id); show the information that is the same 'codigo_familiaE'
I install to jqgrid_dist.php new over old on /lib/inc/
thank yuo again.
I use bouth in
"var rd = jQuery('#<?php echo $g->id?>').jqGrid('getCell', id, 'codigo_familiaE');"
and
"var rd = jQuery('#<?php echo $grid->id?>').jqGrid('getCell', id, 'codigo_familiaE');"
the result is same, blank.
but, This alert('rowid '+id); show the information that is the same 'codigo_familiaE'
Thank you
Enelmann, please ignore last message. Found your email with code.
Will be updating you back on email.
To day in the morning, I send you a e-mail with 2 example.
please answer me.
Thank you again