简体   繁体   English

为UWA.Data.getJson创建多参数回调函数

[英]Creating multiple parameter callback function for UWA.Data.getJson

I'm using the NetVibes UWA widget framework . 我正在使用NetVibes UWA小部件框架

I'm trying to pass multiple parameters to my callback function, which right now, looks like this: 我试图将多个参数传递给我的回调函数,现在看起来像这样:

UWA.Data.getJson(List.URL + '?cmd=getCoursesFromSubjects&faculty=' + subject, List.tickCheckboxes);

Ideally I'd like to do something like this: 理想情况下,我想执行以下操作:

var checked = ('#input').attr("checked");
UWA.Data.getJson(List.URL + '?cmd=getCoursesFromSubjects&faculty=' + subject, List.tickCheckboxes(data,checked));

But that doesn't work. 但这是行不通的。 I've looked at other answers and tried "closure" techniques, but then my data comes back as null . 我查看了其他答案并尝试了“关闭”技术,但随后我的data返回为null

Is this a limitation of the UWA format or am I just doing the closures wrong? 这是UWA格式的限制吗,还是我只是在做关闭操作错误?

Thanks in advance, 提前致谢,

Ah, worked it out. 嗯,解决了。 Was doing my closure wrong. 我的关闭操作有误。

UWA.Data.getJson(List.URL + '?cmd=getSubjectsFromFaculties&faculty=' + faculty, (function(thischecked) {
                  return function(data) {
                     List.tickCheckboxes(data, thischecked);
                  };
               }(checked))
            );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM