从jqgrid单元格中删除

时间:2013-05-18 11:20:52

标签: jquery jqgrid

我创建了带有空单元格的jqGrid表格,但是当我默认点击单元格时,它会显示& nbsp。我需要更改代码以修剪& nbsp

这是我的代码

$(document).ready(function() {

    var lastsel;
    var clientArray = [];

    $("#bms-record-grooms").jqGrid({
        // data: mydata,
        datatype: "local",
        height: '100%',
        Width: '100%',
        scroll: true,
        rowNum: 5,
        scrollOffset: 0,
        rowList: [10, 20, 30],
        colNames: ['SNo', 'Name', 'Duration', 'Start Date', 'End Date', 'Predecessors', 'Resources'],
        colModel: [{ name: 'id', index: 'id', width: 60, sorttype: "int" },
                   { name: 'name', index: 'name', width: 100, editable: true, edit: "Refresh" },
                   { name: 'duration', index: 'duration', width: 100, editable: true },
                   { name: 'startdate', index: 'Date', width: 100, editable: true, sorttype: "date" },
                   { name: 'enddate', index: 'Date', width: 100, editable: true, sorttype: "date" },
                   { name: 'predecessors', index: 'predecessors', width: 100, editable: true },
                   { name: 'Resources', index: 'resources', width: 100, editable: true}],
        pager: "#plist47",
        viewrecords: true,
        sortname: 'name',
        onSelectRow: function(id) {
            if (id && id !== lastsel) {
                jQuery('#bms-record-grooms').saveRow(lastsel);
                jQuery('#bms-record-grooms').jqGrid('editRow', id, true, pickdates, null, 'clientArray', null, function(res) {
                    var idAsNumber = parseInt(id, 10);
                    var nextId = idAsNumber + 1;
                    jQuery('#bms-record-grooms').setSelection(nextId, true);
                    jQuery('#' + nextId + '_Name').focus();
                });
                lastsel = id;
            }
        },
        loadComplete: function() { },
        caption: "Grouping Array Data",
        editurl: "clientArray"
    });
    for (var i = 1; i < 50; i++) {
       jQuery("#bms-record-grooms").addRowData(i, {
          id: i, name: "", duration: "", startdate: "", enddate: "", predecessors: "", Resources: ""
         }, "");
    }
});

function pickdates(id) {
    jQuery("#" + id + "_startdate", "#bms-record-grooms").datepicker({
        dateFormat: "yy/mm/dd"
    });
    jQuery("#" + id + "_enddate", "#bms-record-grooms").datepicker({
        dateFormat: "yy/mm/dd"
    });
}

jqgrid单元格中,它显示&nbsp而不是空单元格。我该如何删除?

0 个答案:

没有答案