简体   繁体   English

搜索点火数据表CodeIgniter

[英]Search on Ignited Datatables CodeIgniter

It's me again and I need your utmost help :) 又是我,我需要您的最大帮助:)

I'm working on with my thesis and got a lot work to do and I did searched a lot and yet still I haven't found the right answer to my problem so here I am. 我正在研究论文,还有很多工作要做,我做了很多搜索,但仍然没有找到正确的答案,所以我就在这里。

Anyway, i am using Codeigniter and Ignited Datatables to show my records. 无论如何,我正在使用Codeigniter和Ignited Datatables显示我的记录。 I have no problem showing the records, but Search and Records Limit are not working. 显示记录没有问题,但是“搜索和记录限制”无效。 I followed this tutorial: http://www.ahmed-samy.com/php-codeigniter-full-featrued-jquery-datatables-part-1/ It's search is working and we got almost the same code. 我遵循了本教程: http : //www.ahmed-samy.com/php-codeigniter-full-featrued-jquery-datatables-part-1/它的搜索工作正常,我们得到了几乎相同的代码。

Here's mine: 这是我的:

script: 脚本:

$(document).ready(function(){
    var oTable = $('#clientDT').dataTable( {
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": 'http://localhost:81/ORPS/client/viewClientsJSON',
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
        "iDisplayStart ": 10,
        "oLanguage": {
            "sProcessing": "<img src='http://localhost:81/ORPS/images/loading-icons/loading3.gif'>"
        },
        "fnInitComplete": function() {
                //oTable.fnAdjustColumnSizing();
         },
        'fnServerData': function(sSource, aoData, fnCallback)
        {
         $.ajax
         ({
            'dataType': 'json',
            'type'    : 'POST',
            'url'     : sSource,
            'data'    : aoData,
            'success' : fnCallback
         });
        },
    } );
});

here's my controller: 这是我的控制器:

function viewClientsJSON(){
            $clientList = $this->clientmodel->clientDT();
            return $clientList;
        }

here's my model: 这是我的模型:

function clientDT(){
            $this->datatables->select('PersonId, LastName, FirstName, MiddleName')
            ->where('PersonTypeId', '1')
            ->where('IsActive', '1')
            ->add_column('Action', get_buttons('client/viewClient/$1', 'client/editClient/$1', '$1'), 'PersonId')
            ->from('person');

            echo $this->datatables->generate();
        }

and my view: 和我的看法:

<div class="table-responsive addMarginTop">
<table id="clientDT" class="table table-condensed table-striped table-hover">
    <thead>
        <tr>
            <th>ID</th>
            <th>Last Name</th>
            <th>First Name</th>
            <th>Middle Name</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

Thanks much for always helping me. 非常感谢您一直以来的帮助。 :) :)

what's the version of DataTables that you are using? 您使用的DataTables是什么版本? If you are using the latest version which is 1.10 then please note that there are lots of changes. 如果您使用的是1.10的最新版本,请注意这里有很多更改。

Refer the link Datatables - Upgrade 1.10 . 请参阅链接“ 数据表-升级1.10” Other than that I won't think there should be any problem. 除此之外,我认为不会有任何问题。

If you are still facing, then try to use the Developer Tools of Chrome or Firefox and see the Conole tab for the possible errors that could help to dig deeper. 如果仍然遇到问题,请尝试使用Chrome或Firefox 开发人员工具 ,并查看“ Conole”选项卡以获取可能有助于更深入了解的可能错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM