修改 type_template.html 引入js
"修改typetemplatecontroller.js ,定義品牌列表資料stylesheet
" href="
../plugins/select2/select2.css
" />
"stylesheet
" href="
../plugins/select2/select2-bootstrap.css
" />"
stylesheet
" href="
../plugins/angularjs/pagination.css
">
$scope.brandlist=,,]};//(3)在type_template.html 用select2元件實現多選下拉框品牌列表
"multiple 表示可多選entity.brandids
" config="
brandlist
" multiple placeholder="
選擇品牌(可多選)
" type="
text
"/>
config用於配置資料**
select2-model用於指定使用者選擇後提交的變數
最終實現效果如下:
1:從後端獲取資料支撐
我們現在讓這個下拉列表的資料從資料庫中提取,修改後端**獲得資料(此處只展示controller)
/selectoptionlist")
public listselectoptionlist()
2:修改youlexuan-manager-web的brandservice.js
//3:修改youlexuan-manager-web的typetemplatecontroller.js下拉列表資料
this.selectoptionlist=function()
因為我們在模板控制層中需要使用品牌服務層的方法,所以需要新增依賴注入
//控制層typetemplatecontroller
' ,function($scope,$controller ,typetemplateservice ,brandservice);//
品牌列表
//讀取品牌列表
$scope.findbrandlist=function();});
}
//4:修改type_template.html ,新增js引入 特別注意一下,js引入的位置,要在typetemplatecontroller.js之前,因為該控制器要使用到它定義方法:獲取json字串中的某個key對應值的集合
$scope.jsontostring =function(jsonstr,key)
value +=jsonobj[i][key];
}return
value;
}
5:修改
type_template.html
,新增初始化
class="hold-transition skin-red sidebar-mini
youlexuan
" ng-controller="
typetemplatecontroller
" ng-init="
findbrandlist()
">
select2 使用筆記
1.把頁面中 可能不在同乙個頁面,一般都是在列表頁介面 的tabindex刪掉 tabindex 1 role dialog aria labelledby mymodallabel aria hidden true 2.重寫enforcefocus方法 fn.modal.constructor.p...
前端外掛程式之Select2使用
工欲善其事,必先利其器 select2是一款基於jquery的下拉列表外掛程式,主要用來優化select,支援單選和多選,同時也支援分組顯示 列表檢索 遠端獲取資料等眾多好用的功能 需要用到的js和css檔案位於專案 下的dist目錄中,需要將這個目錄中的對應檔案放入你的專案裡,這一步不贅述 引入c...
Select2使用方法彙總
引用 1.簡單使用 getjson basic getwarelist function data 根據value選中 form ware val 20007 trigger change 根據text選中 form ware option contains 華南倉 attr selected tr...