jq插件 datatable的使用(附上window一些方法)
2017-12-20 15:51
1076 查看
datatable使用
data 为后端传过来的数组值function initfellTable(data){ datatable = data; $("#myTable").html("<thead><tr><th>"+$.i18n.prop('')+"</th><th>"+$.i18n.prop('')+"</th><th>"+$.i18n.prop('')+"</th><th>"+$.i18n.prop('')+"</th><th>"+$.i18n.prop('')+"</th><th>"+$.i18n.prop('')+"</th><th>"+$.i18n.prop('')+"</th><th>"+$.i18n.prop('')+"</th></tr></thead>"); var TbodyLength =20 // var data = [ // { // "area_id": "Tiger Nixon", // "city_name": "2", // "poorgridnum": "3,120", // "totaldatavolume": "3", // }, // { // "area_id": "Tiger Nixon", // "city_name": "222", // "poorgridnum": "5,300", // "totaldatavolume": "333" // } // ]; var options = { "pagingType": "input", "oLanguage": { "sZeroRecords":$.i18n.prop(''), "oPaginate": { "sFirst": $.i18n.prop(''), "sPrevious": $.i18n.prop(''), "sNext": $.i18n.prop(''), "sLast": $.i18n.prop('') } }, "order": [], "ordering":true, // "retrieve": true, "destroy": true, "searching": true, "bFilter": false, "sDom": '<"H"lr>t<"F"ip>', "bDestory": true, "bAutoWidth": false, "bLengthChange": false, "displayLength": 10, "bSort": true, "scrollX": true, "bPaginate": true, "columnDefs": [{ 'targets' : [0,1,7], //除第六,第七两列外,都默认不排序 'orderable' : false }, { "render": function (data, type, row, rowcol) { return '<img class="imgdetail" src="img/map/r2_c2.png"/>'; }, "targets": [7] }, { "render": function (data, type, row, rowcol) { return '<span title="'+data+'">'+data+'</span>'; }, "targets": [0] } ] } options.data = data //data里面没后端传过来的列名 options.columns= [ { data: 'area_id' }, { data: 'city_name' }, { data: 'pqfeelgridnum' }, { data: 'poorcoveragegridnum' }, { data: 'exceptionusernum' }, { data: 'exceptionvalueusernum' }, { data: 'totaldatavolume' }, ]; $("#myTable").dataTable(options); }
window一些方法
1.window.open()打开一个新的窗口
例子:导出功能
$.ajax({ method: "post", url: '', async:false, data:data, success: function(data){ window.open(data.result) showModalBox(); } });
2.window.location.href
完整的url
url.split(“//”)[1].split(“.”)[0]
split:按指定字符分割字符串
3.window.location.search/location.search
获取url ?后面的部分
function GetRequest() { var url = location.search; //获取url中"?"符后的字串 if (url.indexOf("day")>-1) { var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for(var i = 0; i < strs.length; i ++) { theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); } } }else{ } return theRequest; }
unescape() :可对通过 escape() 编码的字符串进行解码。
该函数的工作原理是这样的:通过找到形式为 %xx 和 %uxxxx 的字符序列(x 表示十六进制的数字),用 Unicode 字符 \u00xx 和 \uxxxx 替换这样的字符序列进行解码。
ECMAScript v3 已从标准中删除了 unescape() 函数,并反对使用它,因此应该用 decodeURI() 和 decodeURIComponent() 取而代之。
相关文章推荐
- dataTable一些使用方法
- jqTransform form表单美化插件使用方法
- 自己使用的sublime的一些插件以及安装方法,以防日后查阅。
- 推荐一些好的mac的插件和使用方法
- jquery 一些方法使用(保留小数、for in 、datatable渲染特殊数据)
- jq 插件 之 datatable 使用
- ExtJS中RowEditing插件的一些使用问题及解决方法
- sublime 插件使用和安装方法以及一些小技巧
- jqTransform form表单美化插件使用方法
- jQuery插件DataTable使用方法详解(.Net平台)
- android debug(adb)window中的使用一些方法
- 使用jquery插件layer代替window.confirm方法
- 使用jquery插件layer代替window.confirm方法
- DoTween插件的一些使用方法
- 二、jq前端分页插件datatable使用
- ckeditor插件的使用方法和一些需要注意的地方。
- Jenkins中关于一些插件的使用方法
- SharpDevelop Addin(插件树) 使用方法
- VSS实现版本控制管理的一些使用方法
- MFC中一些使用的方法