dsi
dsi

Reputation: 3359

jqgrid textbox value not getting update

Problem: unable to get updatable value of textbox in jqgrid.

It just retrieve old value. example - default value of textbox field inside jqgrid is - "0" now, if i update its value to "1" and inspect the field then its value does not get updated into HTML and not able to retrieve with jqgrid object through below syntax.

var rowData = $('#gerList').jqGrid('getRowData', rowId);

Below is my jqgrid stuff:

             $('#gerList').jqGrid({
            ajaxGridOptions: {
                error: function () {
                    $('#gerList')[0].grid.hDiv.loading = false;
                    alert('An error has occurred.');
                }
            },
            url: '@Url.Action("GetEnrolls", "Attendance")/' + 0,
            gridview: true,
            autoencode: true,
            postData: { adID: rowID },
            datatype: 'json',
            jsonReader: { root: 'List', page: 'Page', total: 'TotalPages', records: 'TotalCount', repeatitems: false, id: 'syStudentID' },
            mtype: 'GET',
            colNames: ['GrdID', 'name', 'Minutes', 'comment'],
            colModel: [
                { name: 'syID', index: 'syID', hidden: true },
                { name: 'FullName', index: 'FullName', width: 150 },
                {
                    name: 'Min', index: 'Min', width: 75, align: 'left', formatter: function (cellValue, option) {
                        return '<input type="text" style="width: 40px" name="txtMin" id="txt_' + option.rowId + '" value="' + cellValue + '" />';
                    }
                },
                { name: 'MSG', index: 'MSG', width: 150 }
            ],
            pager: $('#gerListPager'),
            sortname: 'syStudentID',
            rowNum: 40,
            rowList: [40, 80, 120],
            width: '525',
            height: '100%',
            viewrecords: true,
            beforeSelectRow: function (rowid, e) {
                console.log("final");
                var $txt = $(e.target).closest('tr').find('input[type="text"]');
                alert($txt);
                 $txt.attr('value', rowid);
                 return true; // allow row selection*/
                return true;
            },
            sortorder: 'desc'
        }).navGrid('#gerListPager', { edit: false, add: false, del: false, search: false, refresh: false });

Please suggest me what is wrong to use this textbox in jqgrid.

In grid UI, all fields are non editable except textbox field appear to allow edit always.

Thanks

Upvotes: 0

Views: 1193

Answers (1)

cavalsilva
cavalsilva

Reputation: 194

Try to use this:

jQuery("#gerList").saveRow("rowid", false, 'clientArray');

Upvotes: 0

Related Questions