开发者

jqGrid formatCell event doesn't fire

For some reason (unknown to me) the event 'formatCell' doesn't fire (no alert message shown). see code below:

$("#jqgrid").jqGrid({
            datatype: "json",

            colNames: ['CurrecncyID', 'Currency', 'Value', 'Calculated', 'Value', '%', 'Calculated'],
            colModel: [
                        { name: 'CurrecncyID', index: 'CurrecncyID', hidden: true, width: 40 },
                        { name: 'CurrencyName', index: 'CurrencyName', width: 150 },
                        { name: 'FullPrice', index: 'FullPrice', width: 100, editrules: { custom: true, custom_func: priceCheck }, editable: true, align: 'right', formatter: priceFormatter },
                        { name: 'CalcFullPrice', index: 'CalcFullPrice', width: 100, align: 'right', formatter: priceFormatter },
                        { name: 'ActualPrice', index: 'ActualPrice', width: 100, editrules: { custom: true, custom_func: priceCheck }, editable: true, align: 'right', formatter: priceFormatter },
                        { name: 'Precent', index: 'Precent', width: 100, align: 'right', formatter: 'integer', formatoptions: { prefix: "% "} },
                        { name: 'CalcActualPrice', index: 'CalcActualPrice', width: 100, align: 'right', formatter: pr开发者_如何学编程iceFormatter },
                    ],
            onSelectRow: function (id) {
                if (id && id !== lastsel) {
                    jQuery('#jqgrid').restoreRow(lastsel);
                    jQuery('#jqgrid').editRow(id, true);
                    lastsel = id;
                }
            },
            formatCell: function (rowid, cellname, value, iRow, iCol) {
                alert("before edit");
            },
            jsonReader: {
                repeatitems: false
            },
            rowNum: 20,
            rowList: [10, 20, 30],
            pager: '#jqpager',
            sortname: 'CurrecncyID',
            viewrecords: true,
            sortorder: "desc",
            caption: "Prices List",
            autowidth: true,
            height: "100%",
            loadtext: "Loading...",
            editurl: "/handlers/myurl.ashx"
        });`


There are three main editing modes used in jqGrid. The formatCell event is a part of the cell editing mode. It will be not fire in case of usage of editRow and restoreRow are the part of the inline editing mode. Probably you need use custom editable element in case of the usage of the inline editing mode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜