本文介绍了数据表在mRender中获取iDataRow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用数据表和 TableTools 可以在mRender中获取行索引吗?这样的东西: {mData:someData,mRender (data,type,full){ ** // get iDataRow somehow ** return'< a href ='+ data +'>下载'+ ** iDataRow ** +' < / a>'; } } 而不改变数据为了返回iDataRow 建议?解决方案> 数据呈现功能的进化链: fnRender(弃用) mRender columns.render(最新,最强大) 示例: columns.render - 用作函数从数据源创建链接。 $ b数据表({columnDefs:[{targets:0,)$( $ b $数据:download_link,render:function(data,type,full,meta){//meta.row是您要查找的 var ix = meta.row; return行号为+ ix; } }] }); 这是来自datatable论坛的两个相关的未回覆的问题,但第一个参考资料帮助我找出答案: 如何在mData中获取行索引,2013年6月 在mRender中获取行索引,2012年12月 I am using DataTables and the TableToolsIt is possible get row index in mRender? Something like this:{"mData": "someData","mRender" : function ( data, type, full ) { **// get iDataRow somehow** return '<a href="'+data+'">Download '+ **iDataRow** +'</a>'; }}and not alter data for return of iDataRow suggestions? 解决方案 The evolution chain of the datatable render feature: fnRender (deprecated)mRender columns.render (the latest, most powerful)Example: columns.render - Use as a function to create a link from the data source.$('#example').dataTable( { "columnDefs": [ { "targets": 0, "data": "download_link", "render": function ( data, type, full, meta ) { //meta.row is what you are looking for var ix = meta.row; return "Row number is " + ix; } } ]} );Here are two related unanswered questions from datatable forum, but the first contains the references which helped me to find out the answer:How to get row index in mData, June 2013 Get row index in mRender, December 2012 这篇关于数据表在mRender中获取iDataRow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-30 22:12