Passing a variable

QuestionsPassing a variable
David Mills asked 11 years ago

HI
I am trying to set up multi tables and need help.

First – How do I store the selected row to a variable?
Second – How do I display only columns I wish? In the multi-table examples, all the columns are displayed – looks bad. What command allows for that anyway?
Third – Is the option to have an external link fix?

Love this
David

3 Answers
Abu Ghufran answered 11 years ago

Hello,

1) To get variable in JS code, you can use

// returns null if no row is selected OR id of row (single row)
var selr = jQuery('#list1').jqGrid('getGridParam','selrow');

// return array of id's of the selected rows when multiselect options is true. Empty array if not selection
var selr = jQuery('#list1').jqGrid('getGridParam','selarrrow');

2) You need to define column using set_columns() function. Refer docs OR demos/misc/example-all.php

3) Refer demos/appearance/external-link.php for help.

David Mills answered 11 years ago

Thank you for telling me the obvious.
I cannot get the first grid to "Only" show the columns I specify.
After a few days of trying this is what I have…
I renamed the first grid and col variables… What am I forgetting?

can set_columns() only be use once?

3) The demo shows undefined in the grid, that's why I asked

1) is… // returns null if no row is selected OR id of row (single row)
var selr = jQuery('#list1').jqGrid('getGridParam','selrow');
an html call?

Abu Ghufran answered 11 years ago

For 1) It is JS code, and can be called on some event. e.g. onclick event of button.

For 2) Set columns can be used multiple times. Just make sure you don't reference same variables in multiple grids. OR atleast unset them before using in other grid. You can also send your code for review using pastebin.com

3) I can't find undefined in demo. Can you send screenshot:
http://www.phpgrid.org/demo/demos/appearence/external-link.php

Your Answer

11 + 7 =

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?