【问题标题】:Cannot show data in EasyUI datagrid无法在 EasyUI 数据网格中显示数据
【发布时间】:2015-01-27 02:02:56
【问题描述】:

我想用 EasyUI 在弹出对话框中显示一些数据。

我确定我已经从服务器获取了数据,并且我检查了field与Java类中的field是否一致,但我仍然得到一个空白对话框。

我的 JS 代码:

function viewECReportSpec(ecspecName, ecreportSpecName) {
    $('#viewECReportSpec').dialog({
        title : ecreportSpecName + '@' + ecspecName,
        width : 800,
        height : 400,
    });
    $("#viewECReportSpec").dialog('open');

    $('#viewECReportSpecParams').datagrid({
        url : basePath + '/rmws/alereading/getECReportSpec.do',
        queryParams : {
            ecspecName : ecspecName,
            ecreportSpecName : ecreportSpecName
        },
        columns : [[{
            field : 'reportName',
            title : 'Report Name',
            formatter : function(val) {
                alert(val);
            }
        }]],
    });
}

我可以从formatter 的警报中得到正确的reportName,但对话框什么也没有显示。

我错过了什么吗?

【问题讨论】:

    标签: jquery-easyui


    【解决方案1】:

    您应该在检索到数据后生成对话框。我没有看到您的代码中实际将数据放入对话框的任何部分,因此它为空似乎很正常。尝试以下方法:

    function viewECReportSpec(ecspecName, ecreportSpecName) {
        $('#viewECReportSpecParams').datagrid({
            url : basePath + '/rmws/alereading/getECReportSpec.do',
            queryParams : {
                ecspecName : ecspecName,
                ecreportSpecName : ecreportSpecName
            },
            columns : [[{
                field : 'reportName',
                title : 'Report Name',
                formatter : function(val) {
                    alert(val);
                }
            }]],
            onLoadSuccess : function(data) {
                var div = document.createElement('div');
                div.innerHTML = data;
                $(div).dialog({
                    title : ecreportSpecName + '@' + ecspecName,
                    width : 800,
                    height : 400,
                });
            },
        });
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-27
      • 1970-01-01
      • 2014-02-25
      • 2015-05-04
      • 1970-01-01
      • 2013-04-25
      • 2013-12-22
      • 2015-04-12
      相关资源
      最近更新 更多