jQuery的 - 如何设置semanic UI下拉值

我想从选项jQuery的 - 如何设置semanic UI下拉值

statuses = [ 

{ value: 'all', name: 'All' },

{ value: true, name: 'Received' },

{ value: false , name: 'Not Yet' }

];

// my jquery doesn't work

if (params['invoiceStatus'] && params['invoiceStatus'] !== '') {

this.args.invoiceStatus = params['invoiceStatus'];

$('#invoiceStatus').dropdown(

'set selected', params['invoiceStatus']);

} else {

$('#invoiceStatus').dropdown('all');

}

阵列设置一个值下拉我加入这个jQuery:

if (params['invoiceStatus'] && params['invoiceStatus'] !== '') 

{

this.args.invoiceStatus = params['invoiceStatus'];

$('#invoiceStatus').dropdown('set selected', params['invoiceStatus']);

}

else {

$('#invoiceStatus').dropdown('all');

}

但不工作

回答:

https://semantic-ui.com/modules/dropdown.html#/usage

根据语意UI的文档,如果你想有创建dropd拥有与所选值:

var selectedHelper = function (params, name) { 

if (params['invoiceStatus'] === name) return true;

return false;

}

var statuses = [

{

value: 'all',

name: 'All',

selected: selectedHelper(params, 'All'),

},

{

value: true,

name: 'Received'

selected: selectedHelper(params, 'Received'),

},

{

value: false,

name: 'Not Yet'

selected: selectedHelper(params, 'Not Yet'),

}

];

$('#invoiceStatus').dropdown({ values: statuses });

以上是 jQuery的 - 如何设置semanic UI下拉值 的全部内容, 来源链接: utcz.com/qa/260960.html

回到顶部