以下代码可以实现combobox默认选中第一项,在实际开发中我们可能会用到!

// 处理combobox默认选中的问题
 <input >
    valueField:'id',
    textField:'name',
    url:'<?php echo \Yii::$app->urlManager->createUrl('member/my-member/user-type')?>',
    onLoadSuccess:function(){
        var val = $(this).combobox('getData');
        for (var item in val[0]){
            if (item == 'id'){
                 $(this).combobox('select', val[0][item]);
            }
        }
    },
    editable:false"  style="width:150px;"/>

 

相关文章:

  • 2022-12-23
  • 2021-09-08
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-12-09
猜你喜欢
  • 2022-12-23
  • 2021-10-31
  • 2022-02-21
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案