了解 : 怎么处理jobbox status drop down list roll back

that.onStatusEnumChange = function (toStatus) {
  //设计理念是当completed 和 rejected 的状态下,是无法换状态 if (toStatus == "completed" || toStatus == "rejected") { S.confirm("After status change to " + toStatus + ", it will not able to change back, are you sure ?", function () { updateStatus(); }, function () { rollbackValue(); }); } else { updateStatus(); }
  //恢复资料 function rollbackValue() { that.resourceClone.statusEnum = that.resource.statusEnum; }
function updateStatus() {
    //new HttpObj 制作一个请求对象 var updateStatushttpObj = new HttpObj({ url: "//localhost:4745/api/Orders(" + that.resourceClone.id + ")/RPC.changeStatus", method: "POST", data: { toStatusEnum: that.resourceClone.statusEnum } });

    //refreshAsyncHttpObj 制作一个请求对象,同时有promise(把回来的资源给覆盖回之前的资源) var refreshResourceHttpObj = that.resource.extend.refreshAsyncHttpObj();

    //batchHttp 就是把所有请求对象给发出去 batchHttp([updateStatushttpObj, refreshResourceHttpObj], { ajaxCommObject: {} }).then(function () { that.resourceClone = that.resource.extend.cloneForPut(); }, function () { rollbackValue(); }); } }

  

posted @ 2015-10-17 14:35  泉油  阅读(244)  评论(0编辑  收藏  举报
Web Design Johor Bahru Malaysia - Stooges