Value of selected record

QuestionsValue of selected record
Daniele asked 12 years ago

Good evening to all,
how do I get the value of a field, selecting a record in the grid?

Regard

5 Answers
Abu Ghufran answered 12 years ago

You need to do it via little JS code

To get selected row id,

var selr = jQuery('#list1').jqGrid('getGridParam','selrow');
if(selr) alert(selr);
else alert("No selected row");
return false;

To get multiple rows selected,

var selr = jQuery('#list1').jqGrid('getGridParam','selarrrow');
if(selr) alert(selr);

Where list1 is the param passed when rendering grid.

// generate grid output, with unique grid name as 'list1'
$out = $g->render("list1");

Daniele answered 12 years ago

ok, I have done this,
Now the character of the grid is greater,

// render grid
$out = $g->render("list1");

?>

<script type="text/javascript">
var selr = jQuery('#list1').jqGrid('getGridParam','selrow');
if(selr) alert(selr);
else alert("No selected row");
return false;
</script>

$id_riparazione = ???? how do I get id of the selected record in the grid?

$result = mysql_query("SELECT CLIENTE, MARCA, MODELLO, SERIALE, DIFETTO, DIFETTODICHIARATO, NUMERO, RIVENDITORE
FROM schederivenditori WHERE IDRIPARAZIONE = $id_riparazione");

thanks and good day

Abu Ghufran answered 12 years ago

If you want to have master-detail bahavior, that selecting parent grid will reflect change in sub grid … this example is covered in master-detail.php in package.

Emailing you in another thread.

Daniele answered 12 years ago

the example you gave me does not work, if I comment this code table data client, otherwise I do not see anything, and then when I select the row nothing appears in list2

//if ($non_ajax || $_REQUEST["grid_id"] == "list1")

Abu Ghufran answered 12 years ago

if ($non_ajax || $_REQUEST["grid_id"] == "list1") ……….. this check is necessary for 2 grids on same page.

Is the multiple-grid,php file working when placed in package?

Thanks

Your Answer

9 + 20 =

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?