开发者

Datatables doesn't process page changes

I must be doing something wrong, but my code is very basic, hardly even deviating from their example on the web.

I'm using server-side paging, and what I'm experiencing is that on the immediate page load it's pulling in the data from the server and rendering the table just fine. However paging, or changing the number of records on the page does make the AJAX call, but fails to actually process.

If I change line 3562 of jquery.dataTables.js (v 1.8.2) the problem ceases.

if ( false )//json.sEcho*1 < oSettings.iDraw )

Some context for that line:

    function _fnAjaxUpdateDraw ( oSettings, json )
    {
        if ( typeof json.sEcho != 'undefined' )
        {
            /* Protect against old returns over-writing a new one. Possible when you get
             * very fast interaction, and later queires are completed much faster
             */
            if ( false )//json.sEcho*1 < oSettings.iDraw )

Just to demonstrate how straightforward my setup is:

<script type="text/javascript">
    $(function(){

        $('#recTable').dataTable({
                "bProcessing":true,
                "bServerSide": true,
                "sAjaxSource": "/recordings/partPageCallRecordings/",
            "bJQueryUI": true,
            "sPaginationType": "full_numbers",
            "aoColumns": [
                { "bSortable": false },
                null,
                null,
                null,
                { "bSortable": false }
            ]
        });         
    });

</script>

and the H开发者_Python百科TML:

<table id='recTable' class='vmTable' >
    <thead>
        <tr class='vmHeader'>
            <th><input id='selectAll' type='checkbox'></input></th>
            <th class='sortHead'>Date</th>
            <th class='sortHead'>File Name</th>
            <th class='sortHead'>Type</th>
            <th class='sortHead'>Playback</th>
        </tr>
    </thead>
    <tbody>     
    </tbody>
</table>


It looks like you are returning the sEcho data to the client since it gets past the first if block. Are you editing it in any way on the server side? Have you tried putting a breakpoint in firebug on that line to see what sEcho returns? I is basically saying is this request an old request denoted by the sEcho value compared to the up to date iDraw integer.

Without seeing what your json response looks like I can only guess. But my guess would be that sEcho variable is not being set correctly on the server side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜