Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
TerryZ committed Oct 28, 2017
1 parent e937858 commit 6fb5696
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selectpage",
"version": "2.11.0",
"version": "2.12.0",
"description": "A simple style and powerful selection jQuery plugin, including ajax remote data, autocomplete, pagination, tags, i18n, keyboard navigation functions",
"main": "selectpage.js",
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions selectpage.base.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ div.sp_clear_btn {
cursor: pointer;
font-size: 20px;
color: #666666;
font-weight: 600;
margin: 0px;
padding: 7px 0px 0px 0px;
box-sizing: border-box;
Expand Down
1 change: 1 addition & 0 deletions selectpage.bootstrap3.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ div.sp_clear_btn {
cursor: pointer;
font-size: 20px;
color: #666666;
font-weight: 600;
margin: 0px;
padding: 7px 0px 0px 0px;
box-sizing: border-box;
Expand Down
1 change: 1 addition & 0 deletions selectpage.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ div.sp_clear_btn {
cursor: pointer;
font-size: 20px;
color: #666666;
font-weight: 600;
margin: 0px;
padding: 4px 0px 0px 0px;
box-sizing: border-box;
Expand Down
29 changes: 14 additions & 15 deletions selectpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @summary SelectPage
* @desc Simple and powerful selection plugin
* @file selectpage.js
* @version 2.10
* @version 2.12
* @author TerryZeng
* @contact https://terryz.github.io/
* @license MIT License
Expand Down Expand Up @@ -208,7 +208,7 @@
/**
* Plugin version number
*/
SelectPage.version = '2.10';
SelectPage.version = '2.12';
/**
* Plugin object cache key
*/
Expand Down Expand Up @@ -639,21 +639,20 @@
* <input data-init="key">
*/
SelectPage.prototype.setInitRecord = function(refresh) {
var self = this, p = self.option;
if($.type(self.elem.combo_input.data('init')) != 'undefined')
p.initRecord = String(self.elem.combo_input.data('init'));
var self = this, p = self.option, el = self.elem, key = '';
if($.type(el.combo_input.data('init')) != 'undefined')
p.initRecord = String(el.combo_input.data('init'));
//若在输入框中放入了初始化值,则将它放到隐藏域中进行选中项目初始化
//若输入框设置了初始值,同时又设置了data-init属性,那么以data-init属性为优先选择
if(!p.initRecord)
if(self.elem.combo_input.val()) p.initRecord = self.elem.combo_input.val();
self.elem.combo_input.val('');
if((refresh && self.elem.hidden.val()) || $.type(p.initRecord) === 'string'){
// 初始的KEY值放入隐藏域
if(!refresh) self.elem.hidden.val(p.initRecord);
//将初始值放入控件
if (typeof p.data === 'object') {//json数据源模式
if(!refresh && !p.initRecord && el.combo_input.val())
p.initRecord = el.combo_input.val();
el.combo_input.val('');
if(!refresh) el.hidden.val(p.initRecord);
key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
if(key){
if (typeof p.data === 'object') {
var data = new Array();
var keyarr = refresh ? self.elem.hidden.val().split(',') : p.initRecord.split(',');
var keyarr = key.split(',');
$.each(keyarr,function(index,row){
for (var i = 0; i < p.data.length; i++) {
if (p.data[i][p.keyField] == row) {
Expand All @@ -673,7 +672,7 @@
data: {
searchTable: p.dbTable,
searchKey: p.keyField,
searchValue: refresh ? self.elem.hidden.val() : p.initRecord
searchValue: key
},
success: function(json) {
var d = null;
Expand Down
2 changes: 1 addition & 1 deletion selectpage.min.js

Large diffs are not rendered by default.

0 comments on commit 6fb5696

Please sign in to comment.