How to get Select's text from jqGrid column with inline editing

A.K

I need to get the text and value of a cell in jqGrid that is of edittype='select'

Here's my colModel

{ name: 'ResponsibleId', editable: true, width: 140, sortable: false, formatter: 'select', edittype: 'select', editoptions: { value: ResponsibleList } }

I'm using inline editing and free-jqgrid v4.9.0

When I run var respId = $(gridId).jqGrid('getCell', row_id, "ResponsibleId");

It gives me the right value of the item but I need the text as well.

thanks

Oleg

I recommend you to get selected option directly. You need only know that jqGrid assign id on editable fields based on the rule: rowid + "_" + columnName. So the code which you need will be

var $option = $("#" + $.jgrid.jqID(row_id) + "_ResponsibleId option").filter(":selected");

The $option.text() will get you the text and $option.val() gets you the value of currently selected option.

UPDATE: If you need to get the text of the cell which uses formatter: "select" you can do for example the following:

var $grid = $(gridId),
    $tr = $grid.jqGrid("getGridRowById", row_id),
    iCol = $grid.jqGrid("getGridParam", "iColByName").ResponsibleId, // or [colname]
    $tdData = $.jgrid.getDataFieldOfCell.call($grid[0], $tr, iCol);

alert($tdData.text());

$tdData will get you jQuery wrapper to <td> or some internal <span> of <td> which holds the data which you require. $tdData.text() gets you the text from the cell. If the name of column you have in the variable (in colName for example) then you should use [colName] instead of .ResponsibleId.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

jqGrid - Select selected cell's text while inline editing

From Dev

how to implement autocomplete dropdownlist in inline JqGrid editing

From Dev

jqGrid - how to focus cell inline editing

From Dev

how to implement autocomplete dropdownlist in inline JqGrid editing

From Dev

JQGrid remove cell value from custom error message in inline editing

From Dev

jqgrid - save data for inline editing

From Dev

How to get the total time from a column, using jqgrid?

From Dev

JqGrid: How to get all column values from onCellSelect event?

From Dev

JqGrid: How to get all column values from onCellSelect event?

From Dev

How to get "Column Name" and "Previous Value" from Cell Editing Grid

From Dev

How to capture cancel events from inline editing

From Dev

jqGrid form editing select ordering

From Dev

minDate in datepicker while inline editing of jqgrid

From Dev

jqgrid - inline editing, post only changed data

From Dev

minDate in datepicker while inline editing of jqgrid

From Dev

jqGrid: confirm dialog before submit in inline editing?

From Dev

how to save result from number input type in jqgrid form editing

From Dev

How to make element sizes to fill cell sizes and increase font in free jqgrid inline and form editing

From Dev

How to make element sizes to fill cell sizes and increase font in free jqgrid inline and form editing

From Dev

get text from jqgrid cell value

From Dev

How to get the total sum of a column in jqgrid

From Dev

Get text from current editing cell in a Datagrid

From Dev

How to merge the footer row's column in jqgrid

From Dev

How to merge the footer row's column in jqgrid

From Dev

How to get text from the first column in a table?

From Dev

How to hide/show JQGrid inline navigation button from javascript

From Dev

How should I add text to my column's select statement

From Dev

how to select specific value from text column containing an xml string?

From Dev

how to select specific value from text column containing an xml string?

Related Related

  1. 1

    jqGrid - Select selected cell's text while inline editing

  2. 2

    how to implement autocomplete dropdownlist in inline JqGrid editing

  3. 3

    jqGrid - how to focus cell inline editing

  4. 4

    how to implement autocomplete dropdownlist in inline JqGrid editing

  5. 5

    JQGrid remove cell value from custom error message in inline editing

  6. 6

    jqgrid - save data for inline editing

  7. 7

    How to get the total time from a column, using jqgrid?

  8. 8

    JqGrid: How to get all column values from onCellSelect event?

  9. 9

    JqGrid: How to get all column values from onCellSelect event?

  10. 10

    How to get "Column Name" and "Previous Value" from Cell Editing Grid

  11. 11

    How to capture cancel events from inline editing

  12. 12

    jqGrid form editing select ordering

  13. 13

    minDate in datepicker while inline editing of jqgrid

  14. 14

    jqgrid - inline editing, post only changed data

  15. 15

    minDate in datepicker while inline editing of jqgrid

  16. 16

    jqGrid: confirm dialog before submit in inline editing?

  17. 17

    how to save result from number input type in jqgrid form editing

  18. 18

    How to make element sizes to fill cell sizes and increase font in free jqgrid inline and form editing

  19. 19

    How to make element sizes to fill cell sizes and increase font in free jqgrid inline and form editing

  20. 20

    get text from jqgrid cell value

  21. 21

    How to get the total sum of a column in jqgrid

  22. 22

    Get text from current editing cell in a Datagrid

  23. 23

    How to merge the footer row's column in jqgrid

  24. 24

    How to merge the footer row's column in jqgrid

  25. 25

    How to get text from the first column in a table?

  26. 26

    How to hide/show JQGrid inline navigation button from javascript

  27. 27

    How should I add text to my column's select statement

  28. 28

    how to select specific value from text column containing an xml string?

  29. 29

    how to select specific value from text column containing an xml string?

HotTag

Archive