Get value in same page

QuestionsGet value in same page
Cees asked 5 years ago

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");


5 Answers
Abu Ghufran answered 5 years ago

For list2, defaultValue will not work. Following code should be used (just for idea)

$grid["edit_options"]["afterShowForm"] = "function() { get_parent_name(); };

and in html,

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);

Cees answered 5 years ago

Yes Its Work. I'm using auto add.
My code :
But i have trouble, data in add not filtering. Can i filter it like if name in list2 ready auto add error???


Abu Ghufran answered 5 years ago

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.

Cees answered 5 years ago


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…

Abu Ghufran answered 5 years ago

You can call this JS code to reload grid. (where 'list1' is grid identifier)


To use from-to date filter, refer this demo:


Your Answer

7 + 16 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!