【发布时间】:2011-09-09 13:19:03
【问题描述】:
我正在使用来自 codeigniter 控制器的 jquery 数据表显示一个数据表。我想知道的是如何将数据表中的值发送回控制器并使用这些值从数据库中检索新记录,然后将它们再次加载到页面中。
我当前的代码是
$(function(){
$('#tableChart').dataTable( {
// -------Function for formatting the table data elements-------
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
$.each(aData, function (i, elem){
$('td:eq('+i+')', nRow).html( '<b><font color="#40A913">'+aData[i]+'</font></b>' );
})
return nRow;
},
"bAutoWidth": false,
"bProcessing": true,
"bLengthChange": false, // Remove the show list drop down button
"bInfo": false, // Remove info part under the table
"bFilter" : false, // Remove search box
"bDestroy": true, // Remove table & recreate table
"bServerSide": false,
"sAjaxSource": "<?php echo base_url(); ?>index.php/print_db_table/get_print_db_table/<?php echo $table_name; ?>",
});
});
<div class="container">
<div class="holderForTableChart">
<table width ="100%" cellpadding="5" cellspacing="0" class="display" id="tableChart">
<thead>
<tr id="tableHeadder" >
<?php
foreach($table_header as $item):
$header = $item->name;
echo '<th>'.$header.'</th>' ;
endforeach;
?>
</tr>
<tr>
<td></td>
<td>
<select id=""></select>
<select id=""></select>
</td>
<td>
<select id=""></select>
<select id=""></select>
</td>
<td>
<select id=""></select>
<select id=""></select>
</td>
<td>
<select id=""></select>
<select id=""></select>
</td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="6" class="dataTables_empty">Loading data from server</td>
</tr>
</tbody>
</table>
</div>
</div>
现在,当我在任何一个选择框中选择一个最小最大值时,它必须被发送到控制器,我可以从那里将它们发送到模型并收集它们并在视图中重新加载它们
【问题讨论】:
标签: php javascript jquery codeigniter datatable