Note that there are some explanatory texts on larger screens.

plurals
  1. POKnockout loading data very slowly
    primarykey
    data
    text
    <p>I am calling WCF service to load data via jquery ajax calls. WCF service returns data very fast but knockout is loading that data very slowy. Below is my call to wcf service using jquery ajax</p> <pre><code> function loadData(id) { var input = { Id: id }; $.ajax({ url: "../Service/Table/TableData", type: "PUT", contentType: 'application/json', processData: false, data: JSON.stringify(input), error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); }, success: function (allData) { var mappedData= $.map(allData, function (item) { return new TableData(item); }); self.TableDataList(mappedData); } }); } </code></pre> <p>Below is my view</p> <pre><code>&lt;div style="overflow: hidden;margin-top: 30px;margin-left: 10px;float:left;" &gt; &lt;table style="width: 100%" &gt; &lt;colgroup&gt; &lt;col /&gt; &lt;col /&gt; &lt;col/&gt; &lt;/colgroup&gt; &lt;thead&gt;&lt;tr&gt; &lt;th style="padding: 0px"&gt;Id &lt;/th&gt; &lt;th style="padding: 0px"&gt;Name&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;/table&gt; &lt;div style="overflow: auto;height: 490px;"&gt; &lt;table id ="Table1" class="Hover" style="width: 100%;" &gt; &lt;colgroup&gt; &lt;col style="width: 20px"/&gt; &lt;col style="width: 80px"/&gt; &lt;col/&gt; &lt;/colgroup&gt; &lt;tbody data-bind="foreach: TableDataList"&gt; &lt;tr&gt; &lt;td style="padding: 0px;text-align: left" data-bind="text: Id" &gt;&lt;/td&gt; &lt;td style="padding: 0px;" data-bind="text: Name "&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>I am loading about 20000 records and it takes 2 min to load page. How to avoid this?</p> <p><strong>UPDATE1</strong></p> <p>Will using jquery template solve the issue or need to do paging?</p> <p><strong>UPDATE2</strong></p> <p>Here is my code for TableData class</p> <pre><code> function TableData (data) { this.Id = ko.observable(data.Id); this.Name = ko.observable(data.Name); this.LastName = ko.observable(data.LastName ); this.DateOfBirth = ko.observable(data.DateOfBirth ); this.Age= ko.observable(data.Age); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload