Hi,
i've been having this issue and i need help. i have to tables (master-detail obviously), the id (which is the primary key i can save to the detail possible is fine). but i need to pass the value of another column and when i save it. it returns zero. below is my code.
$opt["subgridparams"] = "LevelHeadNum";
….
$e["on_insert"] = array("add_tbl", null, true);
$grid->set_events($e);
….
function add_tbl(&$data)
{
$id = intval($_GET["rowid"]);
$pl = intval($_GET["LeadHeadNum"]);
$data["params"]["HierarchyAdminNum"] = $id;
$data["params"]["ParentNum"] = $pl;
}
The column "ParentNum" keeps saving as 0; it never receives the variable and saves it. It should receive data from the "LeadHeadNum" column in the master grid.
You can debug using firebug, if on ADD ajax request, this GET var (leadHeadnum) is passed or not.
You can also try comparing with demos/master-detail/master-detail.php demo as the vars e.g. company can be used inside detail grid add callback using $_GET.
Thanks Abu for your swift response but the get var(LeadHeadNum) is passed in the string from the master detail. but my problem is that i cant access it from the add_tbl function. as stated above, the $pl variable is always 0;
If LeadHeadNum is string and non-numeric, then you must remove intval(), otherwise it will always be zero.
$pl = intval($_GET["LeadHeadNum"]);
change to:
$pl = $_GET["LeadHeadNum"];
if (empty($pl)) $pl = "";
Thanks again but that's not my problem as i already have all that in check. Please i would like to send you the complete file for your perusal.