第一次动手实现bootstrap table分页效果(2)

function leftChange(obj) { $('#shapeNstSlider').nstSlider("set_position", $(obj).val(), $("#rightLabel").val()); $("#reportTable").bootstrapTable('refresh'); } function rightChange(obj) { $('#shapeNstSlider').nstSlider("set_position", $("#leftLabel").val(), $(obj).val()); $("#reportTable").bootstrapTable('refresh'); } function priceleftChange(obj) { $('#priceNstSlider').nstSlider("set_position", $(obj).val(), $("#pricerightLabel").val()); $("#reportTable").bootstrapTable('refresh'); } function pricerightChange(obj) { $('#priceNstSlider').nstSlider("set_position", $("#priceleftLabel").val(), $(obj).val()); $("#reportTable").bootstrapTable('refresh'); }

这是bootstrap-table带参到后台去的代码 

function queryParams(params) { //配置参数 var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的 pageSize: params.limit, //页面大小 pageNumber: params.pageNumber, //页码 minSize: $("#leftLabel").val(), maxSize: $("#rightLabel").val(), minPrice: $("#priceleftLabel").val(), maxPrice: $("#pricerightLabel").val(), Cut: Cut, Color: Color, Clarity: Clarity, sort: params.sort, //排序列名 sortOrder: params.order//排位命令(desc,asc) }; return temp; }

其它的部分 

function colorChange(obj) { //颜色 var p = $(obj).parent().children('a'); if ($(obj).css("background-color") == "rgb(255, 177, 112)") { $(obj).css("background-color", "white"); $(obj).css("color", "black"); $(obj).attr("h", 1); } else { $(obj).css("background-color", "#FFB170"); $(obj).css("color", "white"); $(obj).attr("h", 0); } var data = []; for (var i = 0; i < $(p).length; i++) { var a = $(p)[i]; if ($(a).attr("h") == "1") { data[i] = $(a).text(); } } Color = ""; for (var i = 0; i < data.length; i++) { if (data[i] != undefined) { Color += "'" + data[i] + "',"; } } Color = Color.substring(0, Color.lastIndexOf(',')); //颜色条件 $("#reportTable").bootstrapTable('refresh'); } function clarityChange(obj) { //净度 var p = $(obj).parent().children('a'); if ($(obj).css("background-color") == "rgb(255, 177, 112)") { $(obj).css("background-color", "white"); $(obj).css("color", "black"); $(obj).attr("h", 1); } else { $(obj).css("background-color", "#FFB170"); $(obj).css("color", "white"); $(obj).attr("h", 0); } var data = []; for (var i = 0; i < $(p).length; i++) { var a = $(p)[i]; if ($(a).attr("h") == "1") { data[i] = $(a).text(); } } Clarity = ""; for (var i = 0; i < data.length; i++) { if (data[i] != undefined) { Clarity += "'" + data[i] + "',"; } } Clarity = Clarity.substring(0, Clarity.lastIndexOf(',')); //净度条件 $("#reportTable").bootstrapTable('refresh'); } function coChange(obj) { //改变颜色事件 if ($(obj).css("background-color") == "rgb(255, 177, 112)") { $(obj).css("background-color", "white"); $(obj).css("color", "black"); } else { $(obj).css("background-color", "#FFB170"); $(obj).css("color", "white"); } }

动作方法是这样的 

/// <summary> /// 分页数据 /// </summary> /// <param>页面大小</param> /// <param>页码</param> /// <param></param> /// <param></param> /// <param>排序的列名</param> /// <param>排序的命令方式</param> /// <returns></returns> /// pageSize,pageNumber请不要更改变量名(sort,sortOrder如需排序,请使用这两个参数,不可更改变量名) public ActionResult AjaxPage(string minSize, string maxSize, string minPrice, string maxPrice, string Shape, string Color, string Cut, string Clarity, int? pageSize, int? pageNumber, string sort, string sortOrder) { //自己写里面的,返回的是Json数据 }

如果大家还想深入学习,可以点击这里进行学习,再为大家附3个精彩的专题:

Bootstrap学习教程

Bootstrap实战教程

Bootstrap Table使用教程

Bootstrap插件使用教程

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzjdzs.html