尝试将新参数插入到select2内部的url属性中时出现问题。
<span><input type="hidden" class="expanded"
data-bind="
select2ex:
{url: '(CONTROLLER_NAME)/(METHOD_NAME)?type=some_type&DocDate=PROBLEM!',
value: ID,
text: NAME,
options:{
minimumInputLength: 1,
ajax: {
params: {
headerErrorsContainer: '#editor .errors-placeholder'
},
cache: true}
},
select2InterfacePropName: 'SomeSelect2'}
"
style="width: 100%"></input></span>
那么如何从jquery的价值中获取(问题!)的地方?
也许可以进行一些字符串插值吗?
...&DocDate={jquery call?}
答案 0 :(得分:0)
您可以尝试通过将计算值分配给url参数来使用它:
...
url: myComputed,
...
self.myComputed = ko.pureComputed(() => {
var type = 'sometype';
var docDate = 'mydate';
return `(CONTROLLER_NAME)/(METHOD_NAME)?type=${type}&DocDate=${docDate}`; //string interpolation
}, self);