本文介绍了具有自定义HTTP标头的Dojo数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有DataGrid连接到REST服务。我需要传递一些自定义HTTP标头(授权等)来获取操作。如何做到这一点?



数据存储是JsonRestStore。

解决方案

  dojo.xhrGet = function(args){// Dojo缺少对自定义头文件支持的解决方法
args.headers = {userId:'xyz',requestedBy:'abc',requestedFrom:'123'};
返回dojo.xhr(GET,args);
};


I have DataGrid that connects to REST service. I need to pass some custom HTTP headers (Authorization and others) to fetch operation. How can I do that?

Data store is JsonRestStore.

解决方案

Better late than never... Here's a workaround; add this function at the beginning of the dojo.addOnLoad() method.

dojo.xhrGet = function(args){// Workaround for Dojo's lack of support for custom headers
   args.headers = {userId:'xyz', requestedBy:'abc', requestedFrom:'123'};
   return dojo.xhr("GET", args);
};

这篇关于具有自定义HTTP标头的Dojo数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 15:05