Hello. I'm using jqGrid, but I'm trying to get the cell value of the grid, but it's not working.

Asked 2 years ago, Updated 2 years ago, 59 views

First of all, there are two grids in total.

There is a main grid (mainGrid) and a subGrid.

You are about to output the value of a cell in the sub-Grid to the printGrid.

I tried to get the cell value using the addRow function and print it out.

addRow($printGridInfo, {
    name : getName();
}
function getName() {
    var gridMain = $("#gridMain");
    var gridSub = $("#girdSub");

    var mainRow = $gridMain.jqGrid('getGridParam', 'selrow');
    var subRow = $gridSub.jqGrid('getGridParam', 'selrow');
    var cellValue = gridSub.jqGrid ('getCell', subRow, 'name'); // Get cell value

    $( "#gridDetail" ).jqGrid ('getRowData', subRow); // Return corresponding RowObject
}

colModel (subGrid)

label: 'Name',
name :  'name',
index : 'name',
align : 'center',
editable : true,
edittype : "select",
formatter : "select",
editoptions : {
    value : names
}

names

"1:khk;2:kmh;3:syj;4:pmy;5:hmy"

It looks like this.

When used as a getName function, it is returned as a null value.

name : $gridSub.getCell(subRow, "name")

If I bring it to , I want to bring khk to 1:khk, but I bring 1.

I want to bring khk, what should I do?

jqgrid jquery

2022-09-22 20:00

1 Answers

Reproducing the situation to jsfiddle (https://jsfiddle.net/) or plunker (https://plnkr.co/) will help.

I'm also using jqwidget, so please upload it.


2022-09-22 20:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.