Home > Web Front-end > JS Tutorial > body text

jqGrid cell content modification_change cell value_setCell

黄舟
Release: 2016-12-28 13:11:32
Original
4063 people have browsed it

When using the jqgrid data table, sometimes you need to modify the content of the cell directly in the interface and edit the cell

The following is an introduction to the method of modifying the cell

 jQuery("#user-list").setCell(3, 'name', 'cht');
Copy after login

Another writing method

 jQuery("#user-list").jqGrid('setCell',3, 'name', 'ddd');
Copy after login

setCell parameter description:

rowid, row number
colname, name attribute in colNames
data, the value to be modified
class, add style

If you encounter the situation where setCell is not easy to use (has no effect), you need to pay attention to

id, and use the rowid in gqgrid

If the cell uses formatter to format data, you need to pay attention to setCell The data value in setCell also needs to match it. For example,

colModel : [
{
label : 'name',
name : 'name',
index : 'name',
formatter : function(cellValue) {
    if (cellValue == 1) {
        return "Yes"
    }
    else {
        return "No";
    }
    return '';
    }
}
]
Copy after login

If you want the cell to display Yes, the data in setCell needs to be written as 1 as follows:

jQuery("#user-list").setCell(3, 'name', '1');
Copy after login

The above is jqGrid cell content modification_ Change the content of cell value_setCell. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!