Get data for the row selected in Jqgrid (with instance)

Source: Internet
Author: User
Tags jqgrid

Gets the data for the row selected in the Jqgrid
How to get the data for the row selected in Jqgrid.
Below you can get the ID of the selection row, if you select multiple rows, the following ID is the ID of the last selected row:

var id=$ (' #gridTable '). Jqgrid (' Getgridparam ', ' selrow ');

If you want to get an ID that selects multiple rows, then these IDs are encapsulated into an array of IDs, which can be used as follows:

var ids=$ (' #gridTable '). Jqgrid (' Getgridparam ', ' selarrrow ');

If you want to get the data for the selected row, just pass in the ROWID, as follows:

var RowData = $ ("#gridTable"). Jqgrid (' GetRowData ', rowId);

And this rowdata is an object, if you want to get the value of the property of the selected row for this object, such as the value of name, you need the following:

var rowname=rowdata.name;

Of course you have to have the name attribute for this object.
Application Examples:

var ids=$ ("#rightGrid9"). Jqgrid ("Getgridparam", "Selarrrow");
if (ids.length==1) {
var rowid=$ ("#rightGrid9"). Jqgrid ("Getgridparam", "Selrow");
$ ("#rightGrid9"). Pangrid ("Downlayer", {"rowID": rowID});
else{
alert ("You have not selected or selected as multiple rows of data and are not allowed to enter the next level");
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.