Twitter bootstrap 代码点火器+;带有引导模型的dataTable自定义删除
到目前为止,我所拥有的: $(文档).ready(函数(){ 型号:Twitter bootstrap 代码点火器+;带有引导模型的dataTable自定义删除,twitter-bootstrap,codeigniter,datatables,jquery-datatables,Twitter Bootstrap,Codeigniter,Datatables,Jquery Datatables,到目前为止,我所拥有的: $(文档).ready(函数(){ 型号: public function getRecords() { $data = array(); $this->db->select("records.id, records.description, relation_1.name, records.relation2") ->from('records') ->join('re
public function getRecords() {
$data = array();
$this->db->select("records.id, records.description, relation_1.name, records.relation2")
->from('records')
->join('relation_1', "relation_1.id = records.relation", 'LEFT')
->where_not_in("deleted", '1');
$query = $this->db->get();
if($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
}
return $data;
}
HTML:
<table id="users" class="table table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>Description</th>
<th>Single 1</th>
<th>Single 2</th>
<th>Delete</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>Description</th>
<th>Single 1</th>
<th>Single 2</th>
<th>Delete</th>
</tr>
</tfoot>
</table>
身份证件
描述
单曲1
单曲2
删除
身份证件
描述
单曲1
单曲2
删除
现在我的问题是:
如何获取ID值以便在以下情况下使用它:
<?php echo site_url("model/delete/$id"); ?>
如果这是不可能的,是否有其他方法来完成此操作?在getRecords模型中定义数据:
public function getRecords() {
$data = $this->db->select("records.id, records.description, relation_1.name, records.relation2")
->from('records')
->join('relation_1', "relation_1.id = records.relation", 'LEFT')
->where_not_in("deleted", '1')
->get()->result();
foreach($data as $d) {
$d->href = '<a href="' . site_url("model/delete/" . $d->id) . '" class="editor_remove" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash"></i></a>';
}
return $data;
}
你能展示你的ajax\u请求函数吗?在这个函数中你定义了你的
完成。如果你需要更多的告诉我。谢谢。我现在得到了它,没有想过从模型中发送它。我还有一个问题。这是实现这个的唯一方法吗?请求从400 kb到1 MB…我想,但文件大并不重要r、 它只是php中的处理,在任何情况下都不会影响性能。
<?php echo site_url("model/delete/$id"); ?>
public function getRecords() {
$data = $this->db->select("records.id, records.description, relation_1.name, records.relation2")
->from('records')
->join('relation_1', "relation_1.id = records.relation", 'LEFT')
->where_not_in("deleted", '1')
->get()->result();
foreach($data as $d) {
$d->href = '<a href="' . site_url("model/delete/" . $d->id) . '" class="editor_remove" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash"></i></a>';
}
return $data;
}
{
"data": null,
"width": "6%",
"className": "center",
"defaultContent": '<a href="<?php echo site_url("model/delete/"); ?>" class="editor_remove" data-toggle="modal" data-target="#myModal"><i class="fa fa-trash"></i></a>'
},
{ "data": "href" },