Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML5模板中的jsgrid_Html_Jsgrid - Fatal编程技术网

HTML5模板中的jsgrid

HTML5模板中的jsgrid,html,jsgrid,Html,Jsgrid,我试图通过HTML5模板重复jsgrid,使用不同的变量调用与datasource相同的ajax调用。 仅渲染第一个栅格 这是可行的,如果可行,请您提供指导 谢谢 以下是脚本: var-template=document.querySelector('template')。内容; 对于(变量i=0;i

我试图通过HTML5模板重复jsgrid,使用不同的变量调用与datasource相同的ajax调用。 仅渲染第一个栅格

这是可行的,如果可行,请您提供指导

谢谢

以下是脚本:

var-template=document.querySelector('template')。内容;
对于(变量i=0;i
我想出来了。工作代码:

 var template = document.querySelector('#template').content;                
 for (var i = 0; i < distinctQuote.length; i++) {

                    document.querySelector('#container').appendChild(document.importNode(template, true));

                    $('.jsGridSnapshot').last().jsGrid({
                        width: "100%",
                        height: "auto",

                        inserting: false,
                        editing: true,
                        sorting: true,
                        autoload: true,
                        noDataContent: "No record found",

                        controller: {
                            loadData: function () {
                                var d = $.Deferred();
                                $.ajax({
                                    url: "/AJAXWebServices/UnderwriterWorksheet/UnderwriterWorksheet.asmx/GetQuickSnapshotByQuoteId",
                                    data: { quoteId: distinctQuote[i] },
                                    dataType: "json",
                                    type: "post"
                                }).done(function (response) {
                                    d.resolve(response);
                                });

                                return d.promise();
                            }
                        },

                        fields: [
                            { name: "QuickSnapShotId", type: "number", visible: false },
                            { name: "QuoteId", type: "number", visible: false },
                            { name: "QuickSnapShotFieldId", type: "number", visible: false },
                            { name: "QuickSnapShotFieldName", title:"", type: "string", width: 100, validate: "required" },
                            { name: "CurrentYear", title:"Current Year", type: "number", width: 200, validate: "required" },
                            { name: "LastYear", title:"Last Year", type: "number", width: 200, validate: "required" }
                        ],

                        });                        
                }
            }
var-template=document.querySelector('#template').content;
对于(变量i=0;i