使用jqGrid使两个表彼此出现

时间:2016-04-14 09:42:15

标签: javascript jqgrid

我正在使用jqGrid,它会打印一个表格,我相信它会打印下面的另一个表格,所以我无法看到它。

如何将它们打印在彼此之下?

如果您想要代码的任何其他部分,请告诉我。



function jqGrid11(data) {
    this.data = data.data;
    this.deletefunction = data.deletefunction;
    this.editfunction = data.editfunction;
    this.insertfunction = data.insertfunction;
};

jqGrid11.prototype = {
    display: function() {
        var html = [];
        var index = 0;
        html.push("<table id='table'>\n<body>");
        html.push("<div id='jqGridPager'>\n</div>");
        html.push("</body>\n</table>");
        $('body').append(html.join(""));

        $("#table").jqGrid({
            url: "index.jsp",
            datatype: "local", 
            data: this.data,
            colModel: this.getColModels(this.data[0]),
            viewrecords: true,
            width: 780,
            height: 250,
            rowNum: 20,
            pager: "#jqGridPager"
        });
    },

    getColNames: function(data) {
        var keys = [];
        for (var key in data) {
            if (data.hasOwnProperty(key)) {
                keys.push(key);
            }
        }

        return keys;
    },

    getColModels: function(data) {
        var colNames = this.getColNames(data);
        var colModelsArray = [];
        for (var i = 0; i < colNames.length; i++) {
            var str;
            str = {
                name: colNames[i],
                index: colNames[i],
            };
            colModelsArray.push(str);
        }

        return colModelsArray;
    }
};
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

您的HTML非常无效。

将您的代码更改为

 const endPoint = subscription.endpoint.slice(subscription.endpoint.lastIndexOf('/')+1);
console.log(endPoint);
var gcm = require('node-gcm');
var message = new gcm.Message({
    notification: {
        title: "Hello, World",
        icon: "ic_launcher",
        body: "This is a notification that will be displayed ASAP.",
        tag:"hello"
    }
});

var regTokens = [endPoint];
  var sender = new gcm.Sender('AIzaSyD9Bcxd_MQZFoGjO1y_hPm-xUdgnM25Ny4'); //API Key
  // Now the sender can be used to send messages
  sender.send(message, { registrationTokens: regTokens }, function (error, response) {
   if (error) {
      console.error(error);
      res.status(400);
    }
   else {
      console.log(response);
      res.status(200);
    }
  });
      })
    })
}

此外,我只看到一张桌子