栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在我的jqgrid中添加一个取消按钮?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在我的jqgrid中添加一个取消按钮?

这是我们的解决方案,与Oleg的解决方案非常相似,主要区别在于我们跟踪XHR列表以确保我们清理所有请求

var handlerUrl = '';jQuery(document).ready(function() {    var xhrList = [];    var beforeSendHandler = function() {        var cancelPendingRequests = function() { jQuery.each(xhrList, function() { this.abort(); }); xhrList = []; return false;        };        var hideLoadingUI = function() { $(this).hide(); $("#load_list").hide();        };        cancelPendingRequests();        $("#load_list").show();// some faffing around to ensure we only show one cancel button at a time        if (jQuery("#cancelrequest").length == 0) { jQuery(".ui-jqgrid-titlebar").append(jQuery("<button   id='cancelrequest'>Cancel</button>").click(cancelPendingRequests).click(hideLoadingUI));        } else { jQuery("#cancelrequest").show();        };      }    jQuery("#list").jqGrid({        datatype: function(postdata) { GetSearchCriteria(); //needed for the grid's filtering var xhr = $.ajax({     //we override the beforeSend so we can get at the XHRs, but this means we have to implement the default behaviour, like showing the loading message ourselves     beforeSend: beforeSendHandler,     dataType: "xml",     data: postdata,     success: function(xmlDoc) {         //         jQuery("#cancelrequest").hide();         $("#load_list").hide();         jQuery("#list")[0].addXmlData(xmlDoc);         xhrList = [];     }



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/388370.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号