my code in list1
$col1["title"] = "title;
$col1["name"] = "name";
$col1["link"] = "#";
$col1["linkoptions"] = "id='doit' onclick=jQuery('#add_list2').click()";
$col1["editoptions"] = array("size"=>30);
and in list2
$getlink=…….?(get value from list1)
$col2["title"] = "title";
$col2["name"] = "name";
$col2["editable"] = true;
$col2["editoptions"] = array("size"=>12, "defaultValue"=>"$getlink");
Thank…
For list2, defaultValue will not work. Following code should be used (just for idea)
$grid["edit_options"]["afterShowForm"] = "function() { get_parent_name(); };
$g->set_options($grid);
and in html,
<script>
function get_parent_name()
{
// read value from selected row of list1
var selr = jQuery('#list1').jqGrid('getGridParam','selrow');
var rd = jQuery('#list1').jqGrid('getCell', selr, 'name');
// set in name field of list2
$("#list2 #name").val(rd);
}
</script>
Yes Its Work. I'm using auto add.
My code : http://pastebin.com/0N0NB2nn
But i have trouble, data in add not filtering. Can i filter it like if name in list2 ready auto add error???
Thanks
For record already exist check, you need to perform server-validation.
This is currently supported in full version.
If you are already using it, refer demos/editing/server-validation.php for already exist error.
$date=date();
$date1=$_POST[date1];
$date2=$_POST[date2];
if (empty($tgl1) AND empty($tgl1)) { $tgl=date("Y-m-d");
$g2->select_command = "SELECT * FROM data1 WHERE date='$date'";
} else {
$g2->select_command = "SELECT * FROM data1 WHERE date BETWEEN '$date1' AND '$date2'";
}
How refresh grid without refresing page???
thanks again…
You can call this JS code to reload grid. (where 'list1' is grid identifier)
jQuery('#list1').trigger("reloadGrid",[{page:1}]);
To use from-to date filter, refer this demo:
http://www.phpgrid.org/demo/demos/search/search-form.php
Code:
http://www.phpgrid.org/demo/demos/search/search-form.phps