1. The list can edit one of the tables and a row of tables, click on a table and click on a column of pop-up window frames.
2 Code
/ / bootstrap table initialize
function init () {
$table.bootstrapTable({
url: relPath() + "/lianxi/list",
height: getHeight(),
striped: true,
search: false,
showRefresh: true,
showColumns: true,
minimumCountColumns: 2,
clickToSelect: true,
detailView: true,
detailFormatter: "detailFormatter",
pagination: true,
paginationLoop: false,
sidePagination: "server",
silentSort: false,
smartDisplay: false,
escape: true,
searchOnEnterKey: true,
showExport: true,
showFullscreen: true,
trimOnSearch: true,
exportOptions: {
fileName: "", //
worksheetName: "haha", //
},
exportDataType: "all",
exportTypes: ["csv", "txt", "sql", "doc", "excel", "xlsx", "pdf"], //*/
toolbar: "-sharptoolbar",
queryParams: function queryParams(params) { //
return {
name: $("-sharpnames").val(), //
remake: $("-sharpremakes").val(), //
// keyword:params.search,//
order: params.order,//
sort: params.sort//
}
},
idField: "id",
maintainSelected: true,
toolbar: "-sharptoolbar",
columns: [
{field: "ck", checkbox: true},
{field: "id", title: "", sortable: true, align: "center"},
{
field: "name", title: "",
editable: {
type: "text",
title: "",
validate: function (value) {
if (!value) return "";
}
}
},
{field: "remake", title: ""},
{
field: "ctime", title: "", sortable: true,
formatter: function (value, row, index) {
return changeDateFormat(value)
}
},
{
field: "imgurl", title: "logo",
formatter: function (value, row, index) {
var s;
if (row.imgurl != null) {
var url = row.imgurl;
s = "<a class = "view" href="javascript:void(0)"><img style="width:300;height:40px;" src="" + url + "" /></a>";
}
return s;
},
//
events: "operateEvents"
},
{
field: "action",
title: "",
align: "center",
formatter: "actionFormatter",
events: "actionEvents",
clickToSelect: false
},
],
//
onEditableSave: function (field, row, oldValue, $el) {
$.ajax({
type: "post",
url: relPath() + "/lianxi/update/" + row.id,
data: row,
dataType: "JSON",
success: function (result) {
if (result.code == 0) {
alert("")
}
},
error: function () {
alert("")
}
})
return false;
}
//
onDblClickRow: function (rows) {
alert(rows.id);
// var row = $table.bootstrapTable("getSelections")
updateDialog = $.dialog({
animationSpeed: 300,
title: "",
content: "url:"+relPath()+"/lianxi/update/"+rows.id,
onContentReady: function () {
initMaterialInput();
}
});
}
});
}