How to add extra view button & right click menu

QuestionsHow to add extra view button & right click menu
Sanchit asked 5 years ago

hello,
i want to add "view" button which gives me the id of selected row,
i also want to add right click menu with few options.

can you please help me how can i add these two options.

1 Answers
Abu Ghufran answered 5 years ago

Following JS will get the id of row:

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

To add row wise button, follow this example:

# Custom made column to show link, must have default value as it's not db driven
$col = array();
$col["title"] = "Details";
$col["name"] = "more_options";
$col["width"] = "30";
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;

# no new line in this html, only space. otherwise it may break ui of grid
$buttons_html = "<input type='button' value='View' onclick=''alert('my-js');";
$col["default"] = $buttons_html;
$cols[] = $col;

For toolbar button, refer demos/appearence/toolbar-button.php

If using free version, these demos are provided with license build.

Your Answer

12 + 4 =

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:

As you found this post useful...

Follow us on social media!

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

Let us improve this post!