zoukankan      html  css  js  c++  java
  • bootstrap-select 使用笔记 设置选中值及手动刷新

    直接笔记: 

      1、页面刚加载完填充select选项数据时,需要手动刷新一下组件,否则没有选项值。(组件初始化时,li 与 option 分离的,需要刷新一下(据说))

      

     $.post('/cpms/todo/getProjectList', data).done(function(result) {
        if(typeof(result) == "string"){
          result = JSON.parse(result.data);
        }
        if(result.data.rows){
          viewModel._helper.projectCodes(result.data.rows); 
          $('.selectpicker').selectpicker('refresh');
        }
        
      }).fail(function (err) {
        return '';
      })
    

      2、组件选中值更改时,即为组件设置选中值时,需要设置一下 val 

    util.backend('cpmsapi/getOrderListForMobile', {ledgerId: keyword}).done(function (result) {
          if (result.ResultCode && result.ResultData.total>0) {
           $('.selectpicker').selectpicker('val',result.ResultData.rows[0].PROJECT_CODE);
           // $('.selectpicker').selectpicker('refresh');
            
          } else {
            viewModel.data(jsonNull)  
            viewModel._helper.failedLoading(true)
            viewModel._helper.failedLoadingMessage('未查询到结果')
          }
    
        }).fail(function (err) {
          viewModel._helper.failedLoading(true)
          viewModel._helper.failedLoadingMessage('查询任务时发生错误')
          console.log(err)
        }).always(function () {
          viewModel._helper.loading(false)
        })
      }
    

      

  • 相关阅读:
    简析IGRP
    unicode字符集查找
    中国移动建成全球最大软交换网络 适合向3G过渡
    寻找端口与进程的关联
    framerelay
    网络工程师的素质
    E1通信的基础知识
    Indy UDP端口冲突解决
    『软考』接入网的分类
    随便写写。。
  • 原文地址:https://www.cnblogs.com/yeyuchangfeng/p/6237709.html
Copyright © 2011-2022 走看看