Click here to Skip to main content
15,885,365 members

Search and Sort Option is not working in Javascript Table

dilzz asked:

Open original thread
HI,

I have ajax code for populate the datas dynamically with html tags.


JavaScript
$.ajax(
               {
                   type: "POST",
                   url: "../../GeneralService.asmx/Get_Bill_Desk_Items",
                   dataType: "json",
                   data: {},
                   contentType: "application/json; charset=utf-8",
                   success: function (json) {

                       var xmlDoc = "";
                       var xml = "";
                       xmlDoc = $.parseXML(json.d);
                       xml = $(xmlDoc);

                       document.getElementById("PopulateBillDeskItems").innerHTML = "";

                       $(xml).find("Table").each(function () {
                           var Category = $(this).find("Category").text();
                           var Table_Room_Code = $(this).find("Table_Room_Code").text();
                           var Table_Room_No = $(this).find("Table_Room_No").text();
                           var Item_Total = $(this).find("Item_Total").text();

                           $("#PopulateBillDeskItems").append(" <tr class='gradeX'><td>" + Category + "</td><td>" + Table_Room_Code + "</td><td>" + Table_Room_No + "</td><td class='center'>" + Item_Total + "</td></tr>");

                       });
                   }
                       });


And in the HTML Page :

HTML
<table id="table-example" class="table">
		   <thead>
		      <tr>
			<th>Category</th>
			<th>Table-Room Code</th>
			<th>Table-Room NO</th>
			<th>Total AMT</th>
		      </tr>
		   </thead>

		  <tbody id ="PopulateBillDeskItems"></tbody>

	      </table>



This code is working fine... But When i go to the page source the HTML code is not populated.but the design side i can see the changes.

And what is my need is,

I have a javascript css Table, And in that table i have populated the datas dynamically using the above code.

And in that table there is search and sort option.
But when i populate datas dynamically using the above code, The search and sort option is not working.

But when i hard-code the datas to that table then the search and sort option is working fine.

Please help me...

Thanks
Dileep..
Tags: Javascript, CSS, HTML, ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900