DataTables: 查询当前表格的状态

列一些常用的JS语句,用于查询当前表格的状态。

查询当前表格的状态

		if(table.order().length > 0){
			//已按其中一列排序?
			...
		}

 		
		 table.columns().eq( 0).each( function ( colIdx ) {		
			 var column = table.column( colIdx );			 
	 		 if(column.search()){
				 //已按某列搜索? 
				 ...
			 }			 
			 
		 });	
		var sexColumn = table.column('sex:name');
		if(sexColumn.search() == 'male'){
			//已按 性别==男 搜索?
			...
		}

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.