appendgrid数据未填充为响应,而是排在网格中的空行

时间:2016-11-22 12:12:13

标签: javascript jquery jquery-plugins

有时我的appendgrid插件没有填充正确的数据,而是没有插入空行作为响应数组长度。

var inputStr = '{"ok":true,"data":{"IssueDetails":[{"Name":"test121","Description":"test131666"}],"StatusDetails":{"L1_Process_ID":"1.0.0","WeeklyStatusText":"test blue1","NextWeekActivity":"p test"},"accessDetails":{"edit":true,"delete":false,"role":""}},"message":"Data retrieved successfully"}';
var responseData = JSON.parse(inputStr);

$('#tblStatusGrid').appendGrid({
        caption: 'Key Issues, Key Decisions, Key OCM Impacts (Including FTE +/-), Business Improvements',
        columns: [{
            name: 'Name',
            display: 'Name',
            type: 'text',
            displayCss: {
                width: '100px',
                height: 'auto'
            },
            ctrlAttr: {
                maxlength: 50
            }
        }, {
            name: 'Description',
            display: 'Description',
            type: 'textarea',
            displayCss: {
                width: '98%',
                height: 'auto'
            },

        }],
        hideButtons: {
            removeLast: true
        },
        //maxBodyHeight: 300,
       // maintainScroll: true
    });

    $('#tblStatusGrid').appendGrid('load', responseData.data.IssueDetails); 

在网格中我应该得到一行数据作为响应,但我得到一个空的。所以请提出解决方案或任何理由。

response : '{"ok":true,"data":{"IssueDetails":[{"Name":"PTP","Description":"DESC build"},{"Name":"PTP2","Description":"Desc Build2"},{"Name":"PTP","Description":"Desc Build33"}],"accessDetails":{"edit":true,"delete":false,"role":""}},"message":"Data retrieved successfully"}'

grid after load

2 个答案:

答案 0 :(得分:0)

查看appendgrid docs here

将dataLoaded方法添加到您的代码中并使用控制台进行观察。

dataLoaded: function (caller, records) {
    onsole.log(record.length);
}

答案 1 :(得分:0)

我找到了问题的答案。

如果我在我的情况下使用多个appendgrids,我有多个标签将数据加载到appendgrids,因此可能存在元素冲突。因此,请更好地检查冲突或清空未显示的其他附加网格的数据,然后加载新数据。