最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What is Client & Server side DataTable processing? - Stack Overflow

programmeradmin10浏览0评论

I have tried but failed in researching on Google and here to get a basic, but good understanding about the meaning of Client and Server side jQuery dataTable processing. I know the Client is usually the web browser and it interacts with the user, and the server is the http server, but not more than that. If someone can please help in giving a brief description on both aspects of data processing? If it is with examples, it would be awesome. And if not, still great.

<table id="datatable" class="table">
    <thead>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Budget)
        ........
    </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
    ...........

<script type="text/javascript">
    $(document).ready(function () {
        $('#datatable').dataTable();
    });
</script>

So, is the script code above all I need to do for Client side processing?

I have tried but failed in researching on Google and here to get a basic, but good understanding about the meaning of Client and Server side jQuery dataTable processing. I know the Client is usually the web browser and it interacts with the user, and the server is the http server, but not more than that. If someone can please help in giving a brief description on both aspects of data processing? If it is with examples, it would be awesome. And if not, still great.

<table id="datatable" class="table">
    <thead>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Budget)
        ........
    </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
    ...........

<script type="text/javascript">
    $(document).ready(function () {
        $('#datatable').dataTable();
    });
</script>

So, is the script code above all I need to do for Client side processing?

Share Improve this question edited Mar 13, 2017 at 0:14 StraightUp asked Mar 12, 2017 at 21:54 StraightUpStraightUp 2251 gold badge5 silver badges18 bronze badges 5
  • With DataTables think of server side processing as having multiple calls to your server side database. An example of this would be paging. Page one of 100 records would be one call while page two of the next 100 would be another. – Tinydan Commented Mar 12, 2017 at 22:28
  • 1 Client side is often when the whole Dataset is given to the client in the first request. Paging, and searching are all done on the client side with no other calls to the server. Large data sets can often be too much for a browsers so server side processing in those situations is often a requirement for performance – Tinydan Commented Mar 12, 2017 at 22:31
  • So, is the script code which I added above in my post all I need to do for Client side dataTable processing? – StraightUp Commented Mar 13, 2017 at 0:15
  • 1 Yes thats the most basic initialisation possible for DataTables. Just make sure you have links to the Datatables.min.js javascript file and its stylesheet. So long as there is data in the table you should have all the basic paging, filter and order functionality show in this table here: datatables/examples/basic_init/zero_configuration.html – Tinydan Commented Mar 13, 2017 at 7:28
  • Thanks a lot for the explanation. – StraightUp Commented Mar 13, 2017 at 14:07
Add a ment  | 

2 Answers 2

Reset to default 6

Please read official documentation regarding processing modes.

  • Client-side processing - the full data set is loaded up-front and data processing (ordering, filtering, pagination) is done in the browser.

    See this example of data table using client-side processing mode.

  • Server-side processing - an Ajax request is made for every table redraw, with only the data required for each display returned. The data processing (ordering, filtering, pagination) is performed on the server.

    See this example of data table using server-side processing mode.

In Simple Words,

Client-Side - All data is sent to the browser once by the server. After that, all is handled by JS in frontend like pagination, sorting, etc.

Server-Side - Ajax call is made to each request and only that particular data is sent. For e.g show 10 records, here an AJAX call is made to fetch these 10 records hence only these records are sent by a server instead of full data. The same goes to pagination, search, filter, etc.

  • For better performance, Server-Side data is the best solution(For huge data).

  • Client-Side is best for less data

发布评论

评论列表(0)

  1. 暂无评论