本文介绍了如何刷新jquery网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! < script> $( function (){ $ .ajax({ type: GET, url: / Test / GetMerchant })。done( function (data){ // $(#leftMenu)。hide(); var MyDateField = function (config){ jsGrid.Field.call(此,config); }; MyDateField.prototype = new jsGrid .Field({ sorter: function (date1,date2){ 返回 new 日期(date1) - new 日期(date2); }, itemTemplate: function (value){ / / 调试器 如果(value == ) return ; else { var date = new 日期(值).toDateString() // var date = new Date(value)。toDateString(MM / dd / yyyy) / / 返回新的日期(值).toDateString(); // 返回值; var d = new 日期(日期), month = ' ' +(d.getMonth()+ 1 ), day = ' ' + d.getDate(), year = d.getFullYear() ; if (month.length< 2 )month = ' 0' +月; if (day.length< 2 )day = ' 0' + day; var df = [month,day,year] .join(' /'); date = df; 返回日期; } }, insertTemplate: function (value){ // debugger return this ._ insertPicker = $( < input>)。 datepicker({defaultDate: new Date ()}); }, editTemplate: function (value){ / / 调试器 return this ._ editPicker = $( < input>)。datepicker({dateFormat: MM / dd / yyyy})。datepicker( setDate, new 日期(值)); }, insertValue: function (){ // 调试器 如果( this ._ insertPicker.datepicker( getDate)!= null ) return this ._ insertPicker.datepicker( getDate); // .toISOString(MM / dd / yyyy) else return this ._ insertPicker.datepicker( getDate); }, editValue: function (){ // 调试器 如果( this ._ editPicker.datepicker( getDate)!= null ){ // .toISOString(MM / dd / yyyy) return 此 ._ editPicker。 datepicker( getDate); } // 返回this._editPicker.datepicker(getDate)。toISOString() ; else return this ._ editPicker.datepicker( getDate); } }); jsGrid.fields.myDateField = MyDateField; $( #jsGrid)。jsGrid({ height: 50%, width: 100%,过滤: true ,编辑: true ,插入: true ,排序: true ,分页: true , autoload: true , pageSize: 12 , pageButtonCount: 5 , // pageLoading:true, deleteConfirm: 你真的想要删除商品吗?,控制器:db,字段:[ {type: control }, { name: Source,类型: text,width: 120 ,title: 供应商 }, { name: 描述,输入: text,width: 210 , validate:{message: 描述是必需的!,验证器: function (value){ return value!= ; } }, { name: ModelNumber ,键入: text,width: 120 ,title: Model#/ Item }, { name: SKU,输入: text,width: 90 }, {name: SKU2,输入: text,width: 90 }, {name: 评论,输入: text,width: 200 }, {name: strReceiveDate,输入: myDateField,宽度: 80 ,对齐: center,title: 收到}, {名称: 位置,输入: 选择,items:data.loc,valueField: LocationID,textField: 描述,宽度: 100 }, {na me: 条形码,宽度: 80 }, {name: BarcodePrinted,类型: 复选框,标题: 打印条形码,排序: false }, {name: strLastUpdatedDate,键入: myDateField,width: 80 ,title: 上次更新}, {name: DamageCode,输入: 选择,items:data.dam,valueField: CodeID,textField: CodeValue,title: 损坏}, {名称: strCreatedDate,editable: false ,width: 80 ,title: 创建日期,键入: myDateField}, {name: strShipDate,输入: myDateField,myCustomProperty: bar,width: 80 ,标题: 发货日期}, {名称: strConsumeDate,输入: myDateField,myCustomProperty: bar, width: 80 ,title: 消费日期}, {name: PendingShipment,输入: 复选框,title: 待定,排序: false ,宽度: 60 }, {name: 捐赠,键入: 复选框,标题: 捐赠,排序: false ,width: 60 }, {name: ReturnRequested ,键入: 复选框,标题: Return Requested,排序: false }, {name: ReturnTo,输入: text,width: 150 ,title: 返回}, {name: 数量,类型: number,width: 50 ,title: Qty}, {name: GroupName ,键入: text,width: 150 ,标题: 组名}, {名称: CustomerID,width: 100 , title: 客户ID},],}); }); }); < / script> 我尝试过: i不知道如何在这里刷新网格内部插入,更新和删除函数调用,我在控制器中显示,但我没有得到它。所以请帮助我紧急解决方案 ( function (){ .ajax({ type: GET, url : / Test / GetMerchant })。done( function (data){ // (#leftMenu)。hide(); var MyDateField = function (config){ jsGrid.Field.call( this ,config); }; MyDateField.prototype = new jsGrid.Field({ sorter: function (date1,date2){ return 新 日期(date1) - new 日期(DATE2); }, itemTemplate: function (value){ / / 调试器 如果(value == ) return ; else { var date = new 日期(值).toDateString() // var date = new Date(value)。toDateString(MM / dd / yyyy) / / 返回新的日期(值).toDateString(); // 返回值; var d = new 日期(日期), month = ' ' +(d.getMonth()+ 1 ), day = ' ' + d.getDate(), year = d.getFullYear() ; if (month.length< 2 )month = ' 0' +月; if (day.length< 2 )day = ' 0' + day; var df = [month,day,year] .join(' /'); date = df; 返回日期; } }, insertTemplate: function (value){ // debugger return this ._ insertPicker = <script> $(function () { $.ajax({ type: "GET", url: "/Test/GetMerchant" }).done(function (data) { //$("#leftMenu").hide(); var MyDateField = function (config) { jsGrid.Field.call(this, config); }; MyDateField.prototype = new jsGrid.Field({ sorter: function (date1, date2) { return new Date(date1) - new Date(date2); }, itemTemplate: function (value) { //debugger if (value == "") return ""; else { var date = new Date(value).toDateString() //var date = new Date(value).toDateString("MM/dd/yyyy") //return new Date(value).toDateString(); //return value; var d = new Date(date), month = '' + (d.getMonth() + 1), day = '' + d.getDate(), year = d.getFullYear(); if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; var df = [month, day, year].join('/'); date = df; return date; } }, insertTemplate: function (value) { //debugger return this._insertPicker = $("<input>").datepicker({ defaultDate: new Date() }); }, editTemplate: function (value) { //debugger return this._editPicker = $("<input>").datepicker({ dateFormat: "MM/dd/yyyy" }).datepicker("setDate", new Date(value)); }, insertValue: function () { // debugger if (this._insertPicker.datepicker("getDate") != null) return this._insertPicker.datepicker("getDate"); //.toISOString("MM/dd/yyyy") else return this._insertPicker.datepicker("getDate"); }, editValue: function () { //debugger if (this._editPicker.datepicker("getDate") != null) { //.toISOString("MM/dd/yyyy") return this._editPicker.datepicker("getDate"); } //return this._editPicker.datepicker("getDate").toISOString(); else return this._editPicker.datepicker("getDate"); } }); jsGrid.fields.myDateField = MyDateField; $("#jsGrid").jsGrid({ height: "50%", width: "100%", filtering: true, editing: true, inserting: true, sorting: true, paging: true, autoload: true, pageSize: 12, pageButtonCount: 5, //pageLoading: true, deleteConfirm: "Do you really want to delete the merchandise?", controller: db, fields: [ { type: "control" }, { name: "Source", type: "text", width: 120, title: "Vendor" }, { name: "Description", type: "text", width: 210, validate: { message: "Description is required!", validator: function (value) { return value != ""; } } }, { name: "ModelNumber", type: "text", width: 120, title: "Model#/Item" }, { name: "SKU", type: "text", width: 90 }, { name: "SKU2", type: "text", width: 90 }, { name: "Comments", type: "text", width: 200 }, { name: "strReceiveDate", type: "myDateField", width: 80, align: "center", title: "Received" }, { name: "Location", type: "select", items: data.loc, valueField: "LocationID", textField: "Description", width: 100 }, { name: "Barcode", width: 80 }, { name: "BarcodePrinted", type: "checkbox", title: "Barcode Printed", sorting: false }, { name: "strLastUpdatedDate", type: "myDateField", width: 80, title: "Last Updated" }, { name: "DamageCode", type: "select", items: data.dam, valueField: "CodeID", textField: "CodeValue", title: "Damage" }, { name: "strCreatedDate", editable: false, width: 80, title: "Created Date", type: "myDateField" }, { name: "strShipDate", type: "myDateField", myCustomProperty: "bar", width: 80, title: "Ship Date" }, { name: "strConsumeDate", type: "myDateField", myCustomProperty: "bar", width: 80, title: "Consume Date" }, { name: "PendingShipment", type: "checkbox", title: "Pending", sorting: false, width: 60 }, { name: "Donated", type: "checkbox", title: "Is Donated", sorting: false, width: 60 }, { name: "ReturnRequested", type: "checkbox", title: "Return Requested", sorting: false }, { name: "ReturnTo", type: "text", width: 150, title: "Return To" }, { name: "Quantity", type: "number", width: 50, title: "Qty" }, { name: "GroupName", type: "text", width: 150, title: "Group Name" }, { name: "CustomerID", width: 100, title: "Customer ID" }, ], }); }); });</script>What I have tried:i have no idea how to refresh grid here internal insert,update and delete function call and i show in controller but i dont get it. so please help me its urgent 解决方案 (function () {.ajax({ type: "GET", url: "/Test/GetMerchant" }).done(function (data) { //("#leftMenu").hide(); var MyDateField = function (config) { jsGrid.Field.call(this, config); }; MyDateField.prototype = new jsGrid.Field({ sorter: function (date1, date2) { return new Date(date1) - new Date(date2); }, itemTemplate: function (value) { //debugger if (value == "") return ""; else { var date = new Date(value).toDateString() //var date = new Date(value).toDateString("MM/dd/yyyy") //return new Date(value).toDateString(); //return value; var d = new Date(date), month = '' + (d.getMonth() + 1), day = '' + d.getDate(), year = d.getFullYear(); if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; var df = [month, day, year].join('/'); date = df; return date; } }, insertTemplate: function (value) { //debugger return this._insertPicker = 这篇关于如何刷新jquery网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 16:16