Home > front end >  About bootstraptable use x - the editable controls select2 type problems
About bootstraptable use x - the editable controls select2 type problems

Time:12-07

1. Page all data have been through, inline editing interface effect as shown below:

Select2 can choose also can search, but the problem is that select2 data is loading the page in the first time put all data directly to the load, the realization of data source on the local,

I want to achieve is to search from the server to the load data
HTML code is as follows, please tell god:
 
Var TableInit=function () {
Var oTableInit=new Object ();
//initialize the Table
OTableInit. Init=function () {
$(" # checkMedical "). BootstrapTable ({
Url: "${CTX} medicalhistory/backtrackmhistoryinfo",
Type: "get",
Pagination: true,//paging
Striped: true,//whether the lines between color
Cache: true,//whether to use the default cache to true
Sortable: false,//whether to enable sorting
SortOrder: 'asc',//sort way
UndefinedText: "'
ClickToSelect: true,//click select the corresponding checkbox
AjaxOptions: {async: false},
SidePagination: 'server',//paging: client client pages, paging server service
Initialization pageNumber: 1,//load the first page, the default page 1
PageSize: 5,//the number of rows per page
PageList: [10, 15, 20],//the number of rows per page available
Search: false,//whether the display table search, the search is the client, not into the service side
PaginationPreText: "previous page",
PaginationNextText: "next page",
FixedColumns: false,//fixed column
FixedNumber: 4,//fixed the first two columns
QueryParams: oTableInit queryParams,//pass parameters (*)
ResponseHandler: function (res) {
The console. The log (res)
return res;
},
The columns: [
[{
The checkbox: true,
Align: "center",
Valign: "middle"

}, {
Field: 'Name',
Title: 'line',
Rowspan: '2',
The formatter: function (the value, the row, the index) {
Return index + 1;
}
}, {
Field: "BSID00,"
Title: "ID",
}, {
Field: "BSMC00,"
History of the title: "name",
The editable: {
Type: 'text',
Title: 'name' history,
Validate: function (v) {
if (! V) return 'history name cannot be empty;
}
}
}, {
Field: "SFCY00,"
Title: "common",
The editable: {
Type: "select",
The separator: ",, "
Source: [{value: '1', the text: 'common'},
{value: '0', the text: 'unusual'},
}
}, {
The field: ", "
Title: "the history category,"
}, {
Field: "ICDBM0,"
Title: "ICD coding,"
The editable: {
Type: 'select2,
Title: 'the ICD coding,
Name: 'ICDBM0'
Source: the function () {//dynamic data
var result=[];
$. Ajax ({
Url: "${CTX} medicalhistory/Type_select2",
Async: false,
Type: "get",
Data: {" sign ":" 3 "},
Success: the function (data) {
$. Each (data. The data, the function (I, item) {
var obj={};
Obj. Id=item. ICDBM0;
Obj. Text=item. ICDBM0;
Result. Push (obj);
});
}
});
return result;
},
Emptytext: "no,"
Select2: {
//tags: true,
AllowClear: true,
Language: "useful - CN,"
Placeholder: 'please select ICD code',
Width: 150 px,//set wide
Id: function (item) {
Return the item. The text;
}
}
}
}, {
Field: "XB0000,"
Title: "gender",
The editable: {
Type: "select",
The separator: ",, "
Source: [{value: '2', the text: 'women'}, {value: '1', the text: 'male'},
{value: '0', the text: 'no'},
}
}, {
The field: ", "
Title: "serial number",
}, {
Field: "YXBZ00,"
Title: "effective sign,"
The editable: {
Type: "select",
The separator: ",, "
Source: [{value: '1', the text: 'effective'},
{value: '0', the text: 'invalid'},
}
}, {
Field: "BZBH00,"
Title: "online standard code,"
The editable: {
Type: 'text',
Title: 'online standard coding,
Emptytext: "no,"
}
}, {
Field: "YSSM00,"
Title: "diet instructions (package),"
The editable: {
Type: 'text',
Title: 'diet instructions (package),
Emptytext: "no,"
}
}, {
Field: "JLMC00,"
Title: "conclusion",
The editable: {
Type: 'select2,
Title: 'conclusion',
Emptytext: "no,"
Name: 'JLMC00'
Source: the function () {//dynamic data
var result=[];
$. Ajax ({
Url: "${CTX} medicalhistory/Type_select2",
Async: false,
Type: "get",
Data: {" sign ":" 4 "},
Success: the function (data) {
$. Each (data. The data, the function (I, item) {
var obj={};
Obj. Id=item. JLMC00;
Obj. Text=item. JLMC00;
Result. Push (obj);
});
}
});
return result;
},
Emptytext: "no,"
Select2: {
//tags: true,
AllowClear: true,
Language: "useful - CN,"
Placeholder: 'please select conclusion,
Width: 150 px,//set wide
Id: function (item) {
Return the item. The text;
}
}
}
}, {
Field: 'operator',
Title: 'operation',
The formatter: setformete
}], [
{
Field: "BSLBMC,"
Title: "adult",
The editable: {
Type: 'select2,
Title: 'adults',
Name: 'BSLBID'
Source: the function () {//dynamic data
var result=[];
$. Ajax ({
Url: "${CTX} medicalhistory/Type_select2",
Async: false,
Type: "get",
Data: {" sign ":" 1 "},
Success: the function (data) {
$. Each (data. The data, the function (I, item) {
var obj={};
Obj. Id=item. LBMC00;
Obj. Text=item. LBMC00;
Result. Push (obj);
});
}
});
return result;
},
Emptytext: "no,"
Select2: {
//tags: true,
AllowClear: true,
Language: "useful - CN,"
Placeholder: 'please choose history',
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related