jquery之datatable.js与CI整合 异步加载(大数据量处理)

1、CI 控制器添加方法        $this->show_fields_array=array(            "truename"=>"小编账号",            "item_goods"=>"爆料标题",            "item_store"=>"商城",            "post_status"=>"爆料状态",   
摘要由CSDN通过智能技术生成

1、CI 控制器添加方法


        $this->show_fields_array=array(
            "truename"=>"列1",
            "item_goods"=>"列2",
            "item_store"=>"列3",
            "post_status"=>"列4",
            "post_date"=>"列5",
            "goods_from"=>"列6"
        );


        $this->select_fields=implode(",",array_keys($this->show_fields_array));


 /**
     * 加载列表页
     */
    public function index()
    {
        $result=$this->menu;
        $result["all_table"]=$this->create_table("all_table");
        $result["internal_table"]=$this->create_table("internal_table");
        $result["overseas_table"]=$this->create_table("overseas_table");
        $result["show_fields"]=$this->select_fields;
        $this->Header('public/header', $result);
        $this->Left_Menu('public/left_menu', $result);
        $this->Template('bl/data_statistics', $result);
        $this->Footer('public/footer', $result);
    }


    /**
     * 获取列表数据
     */
    public function get_data_tables(){
        $param["sEcho"] = $this->input->get('sEcho',true); // DataTables 用来生成的信息
        $param["start"] = $this->input->get('iDisplayStart',true); //显示的起始索引
        $param["length"] = $this->input->get('iDisplayLength',true);//显示的行数
        $param["sort_th"] = $this->input->get('iSortCol_0',true);//被排序的列
        $param["sort_type"] = $this->input->get('sSortDir_0',true);//排序的方向 "desc" 或者 "asc".
        $param["search"] = $this->input->get('sSearch',true);//全局搜索字段
        $param["select_fields"]=$this->select_fields;
        $param["show_fields_array"]=$this->show_fields_array;
        $output=$this->bl_ds->fetch_more($param);
        $output=$this->handle_list($output);
        echo json_encode($output); //最后把数据以json格式返回
    }


    /**
     *  处理列表数据
     * @param $output
     * @return mixed
     */
    private function handle_list($output){

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值