在spreadjs菜单栏中增加了保存按钮,在保存的时候,想用ajax的loading来做效果,使用了ajax的默认方法,结果不显示,求助 代码如下,红色代码为没有效果的地方, var saveCommand = { "save":{ title: "保存", iconClass: "ribbon-button-save", commandName: "save", execute: async (context, propertyName, fontItalicChecked) => { var spread = context.getWorkbook(); var spreadJSON = JSON.stringify(spread.toJSON({ includeBindingSource: true })); var zipJSON = gzipString(spreadJSON); url = window.location.href; var uid = getParameter(url,1); var accountCode = getParameter(url,2); var projectId = getParameter(url,3); $.ajax({ url: "/manuscript/updateAccountdraft", data: {'content':zipJSON,'projectId':projectId,'accountCode':accountCode,'uid':uid}, dataType: "json", type: "PUT", headers: { "Content-Encoding": zipJSON.length>1000?"gzip":"" }, success: function (retObject) { if (retObject.code == "1") { var str = ungzipString(retObject.record); var json = JSON.parse(str); spread.fromJSON(json, { doNotRecalculateAfterLoad: true }); alert(retObject.msg); } }, beforeSend:function(){ //在次如何写loading的效果 $.messager.progress(); //这样写的不会出现效果 }, complete: function() { $.messager.progress('close'); } }) } }, "excel":{ title: "导出为Excel", iconClass: "ribbon-button-excel", commandName: "excel", execute: async (context, propertyName, fontItalicChecked) => { var spread = context.getWorkbook(); var sheet = spread.getActiveSheet(); var selectionRange = sheet.getSelections(); } } }
var saveGroup = { "label": "操作", "thumbnailClass": "ribbon-button-save", "commandGroup": { "children": [ { "direction": "vertical", "commands": ["save","excel"] } } }
|