设为首页 加入收藏

TOP

MVC bootstrap-table显示数据时显示No matching records found(一)
2019-09-17 16:40:34 】 浏览:44
Tags:MVC bootstrap-table 显示 数据时 matching records found

问题:bootstrap-table加载数据不显示

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script>
  $(function () {
  InitMainTable();
  document.onkeydown = function (e) {

  var ev = document.all ? window.event : e;
  if (ev.keyCode == 13) {// 如(ev.ctrlKey && ev.keyCode==13)为ctrl+Center 触发
  $("#table").bootstrapTable('refresh');
  }
}
  $("#rearch").click(function () {
  $("#table").bootstrapTable('refresh');
  });
});
 function InitMainTable() {
  //先销毁表格
  $("#table").bootstrapTable('destroy');
  $("#table").bootstrapTable({
  method: "get"
  , url: "/Type/DataList"
  , striped: true, //表格显示条纹
  pagination: true,// 是否显示分页
  pageSize: 10, //每页显示条数
  pageNumber: 1,//当前第几页
  search: true, //显示搜索框
  buttonsAlign: "right", //按钮对齐方式
  pageList: [5, 10, 15, 20, 25],
  showColumns: true,
  showRefresh: true, //是否显示刷新按钮
  sidePagination: "server", //表示从服务端获取数据
  queryParamsType: "undefined", //定义参数类型
  queryParams: function (params) {
  //console.log(params);
  var param = {
  keyword: $("#search").val(),//搜索
  pageIndex: params.pageNumber,
  pageSize: params.pageSize
  };
    return param;
  },
  columns: [{
  field: "TypeName"
  , title: "名称"
  , sortable: true
  }, {
  field: "Typeva lue"
  , title: "类型值"
  , sortable: true
  }, {
  field: "FullPath"
  , title: "表名"
  , sortable: true
  }, {
  field: "StateName"
  , title: "是否显示"
  , sortable: true
  , formatter: function (value, row, index) {
  var isdisplay = row["StateName"];
  if (isdisplay == "6f9619ff-8b86-d011-b42d-34c04fc964ff") {
  isdisplay = ' <span class="label label-lg label-yellow arrowed-in">是</span>';
  } else {
  isdisplay = '<span class="label label-lg label-purple arrowed">否</span>';
  }
  return isdisplay;
  }
  }, {
  title: '操作',
  align: 'center',
  width: 230,
  formatter: function (value, row, index) {

  var icon = '<button class="btn btn-xs btn-primary" onclick="Update(\'' + row.TyId + '\')"><i class="icon-edit bigger-120">编辑</i></button> '

  icon += '<button class="btn btn-xs btn-danger" onclick="Del(\'' + row.TyId + '\')"><i class="icon-trash bigger-120">删除</i></button>';

  return icon;
  }
}],
onLoadSuccess: function (data) {
  console.log(data);
},
onLoadError: function () {
  alert("数据加载失败!");
}
});
}
//删除
function Del(tyid) {
  if (confirm("你确定要删除吗?")) {
   $.post("/Type/Reovme", { tyid: tyid }, function (data) {
    if (data.code == 200) {
      window.location.reload();
    } else {
      layer.msg(data.msg, { icon: 5 });
    }
  });
  }
}
function Update(typeid) {
  window.location.href = "/Type/AddUpdate?typeId="+typeid;
}
function Add() {
  window.location.href = "/Type/AddUpdate";
}
</script>
<div class="input-group col-md-3" style="margin-top:0px">
<input type="text" class="form-control"placeholder="请输入字段名" id="search" / >
<span class="input-group-btn">
<button class="btn btn-sm btn-search" id="rearch">
<i class="icon-search bigger-110"></i>
<span class=&q

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C#订阅与发布标准实现 下一篇telerik:RadGrid 分组自动展开

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目