搜索和排序选项在Javascript表中不起作用 [英] Search and Sort Option is not working in Javascript Table

查看:86
本文介绍了搜索和排序选项在Javascript表中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我有一个Ajax代码,可使用html标签动态填充数据.




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


$.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>");

                       });
                   }
                       });



在HTML页面中:



And in the HTML Page :

<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>




这段代码可以正常工作...但是当我转到页面源代码时,不会填充HTML代码.但是在设计方面,我可以看到更改.

我需要的是

我有一个JavaScript CSS表格,并且在该表格中,我使用上面的代码动态填充了数据.

在该表中有搜索和排序选项.
但是当我使用上述代码动态填充数据时,搜索和排序"选项不起作用.

但是,当我将数据硬编码到该表时,搜索和排序选项就可以正常工作.

请帮帮我...

谢谢
Dileep ..




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..

推荐答案

.ajax( { 类型:" , 网址:" , dataType:" , 数据: {}, contentType:" , 成功:功能(json){ var xmlDoc = " ; var xml = " ; xmlDoc =
.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 =
.parseXML(json.d); xml =


(xmlDoc); 文档 .getElementById(" ) .innerHTML = " ;
(xmlDoc); document.getElementById("PopulateBillDeskItems").innerHTML = "";


这篇关于搜索和排序选项在Javascript表中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆