mirror of https://gitee.com/karson/fastadmin.git
改进普通搜索插件——支持传入css样式
parent
78ff548544
commit
7003e5312a
|
|
@ -51,7 +51,7 @@
|
|||
return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
|
||||
}
|
||||
var htmlForm = [];
|
||||
htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
|
||||
htmlForm.push(sprintf('<form class="%s" novalidate method="post" action="%s">', that.options.searchFormCss.form, that.options.actionForm));
|
||||
htmlForm.push('<fieldset>');
|
||||
if (that.options.titleForm.length > 0)
|
||||
htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
|
||||
|
|
@ -66,9 +66,9 @@
|
|||
vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
|
||||
ColumnsForSearch.push(vObjCol);
|
||||
|
||||
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
|
||||
htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
|
||||
htmlForm.push('<div class="col-xs-8">');
|
||||
htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.form_group));
|
||||
htmlForm.push(sprintf('<label for="%s" class="%s">%s</label>', vObjCol.field, that.options.searchFormCss.label, vObjCol.title));
|
||||
htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.container));
|
||||
|
||||
vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
|
||||
htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
|
||||
|
|
@ -132,7 +132,8 @@
|
|||
htmlForm.push('</div>');
|
||||
}
|
||||
}
|
||||
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
|
||||
htmlForm.push(sprintf('<div class="%s">', that.options.searchFormCss.form_group));
|
||||
htmlForm.push(sprintf('<label class="%s"> </label>', that.options.searchFormCss.label_btn));
|
||||
htmlForm.push(createFormBtn(that).join(''));
|
||||
htmlForm.push('</div>');
|
||||
htmlForm.push('</div>');
|
||||
|
|
@ -146,7 +147,7 @@
|
|||
var htmlBtn = [];
|
||||
var searchSubmit = that.options.formatCommonSubmitButton();
|
||||
var searchReset = that.options.formatCommonResetButton();
|
||||
htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
|
||||
htmlBtn.push(sprintf('<div class="%s">', that.options.searchFormCss.container));
|
||||
htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
|
||||
htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
|
||||
htmlBtn.push('</div>');
|
||||
|
|
@ -297,7 +298,7 @@
|
|||
|
||||
var that = this,
|
||||
html = [];
|
||||
if(that.options.showSearch){
|
||||
if (that.options.showSearch) {
|
||||
html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
|
||||
html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="commonSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatCommonSearch()));
|
||||
html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
|
||||
|
|
@ -366,8 +367,8 @@
|
|||
[value, item, i], value);
|
||||
|
||||
if (!($.inArray(key, that.header.fields) !== -1 &&
|
||||
(typeof value === 'string' || typeof value === 'number') &&
|
||||
(value + '').toLowerCase().indexOf(fval) !== -1)) {
|
||||
(typeof value === 'string' || typeof value === 'number') &&
|
||||
(value + '').toLowerCase().indexOf(fval) !== -1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
|||
import_url: '',
|
||||
multi_url: '',
|
||||
dragsort_url: 'ajax/weigh',
|
||||
},
|
||||
searchFormCss: {
|
||||
form: 'form-commonsearch',
|
||||
form_group: 'form-group col-xs-12 col-sm-6 col-md-4 col-lg-3',
|
||||
label: 'control-label',
|
||||
label_btn: 'control-label hidden-xs',
|
||||
container: 'pp_container',
|
||||
}
|
||||
},
|
||||
// Bootstrap-table 列配置
|
||||
|
|
|
|||
Loading…
Reference in New Issue