是否可以使用jquery绑定和排序gridview?任何人都可以帮忙 [英] Is it possiible binding and sorting gridview using jquery? Can anybody help
本文介绍了是否可以使用jquery绑定和排序gridview?任何人都可以帮忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已尝试在juery中绑定它是成功的,但没有排序绑定和我使用Web服务进行排序我已经使用插入js文件tablesort.js
我尝试了什么:
i尝试在juery中绑定它是否成功,但没有排序绑定和我使用Web服务进行排序我已经使用插入js文件tablesort.js
<预> < script language = javascript type = text / javascript>
window .onload = function (){
fnLoading_Start( );
var jsonData = {};
jsonData.TRANSTYPE = II
var weburl = ../../ UI / ws / ws_Accounts.asmx / ACC_INV_PRINT_AUTHORISATION 跨度>;
JSON .stringify(jsonData);
$ .ajax({
type: POST,
url:weburl,
data: JSON .stringify(jsonData),
contentType: application / json; charset = utf-8,
dataType: < span class =code-string> json,
成功:OnSuccess,
失败:功能(响应){
alert( 失败: + response.d);
},
错误: function (响应){
alert( 错误: + response.d);
}
});
return false ;
}
function OnSuccess(响应){
// alert(response.d);
var xmldoc = $ .parseXML(response.d);
var xml = $(xmldoc);
var InvAuth = xml.find( 表跨度>);
// 从gridview的最后一行创建一个新行
var row = $( [id * = dgInvoice] tr:last-child)。clone( true );
// 删除通过在页面加载后面的代码绑定虚拟行而创建的第一行
$( [id * = dgInvoice] tr)。not($(< span class =code-string> [id * = dgInvoice] tr:first-child))。remove();
// 查找隐藏字段并获取CustomerId。
$。 each(InvAuth, function (){
var InvAuth = $( this );
$( td, ()#(此)。find( TRNS_TYPE)。text());
$( td,row).eq( 2 )。html($( this )。find( INV_CRTNO)。 ());
$( td,row).eq( 3 )。html($( this )。find( INV_CRTDT)。text());
$( td,row).eq( 4 )。html($( this )。find( CREATEDBY跨度>)文本())。
$( td,row).eq( 5 )。html($( this )。find( INV_CRT_DAT跨度>)文本())。
$( td,row).eq( 6 )。html($( this )。find( CLIENTNAME跨度>)文本())。
$( td,row).eq( 7 )。html($( this )。find( TOTAL_AMT跨度>)文本())。
$( [id * = dgInvoice])。append(row);
row = $( [id * = dgInvoice] tr:last-child) .clone( true );
});
fnLoading_Stop();
}
$( document )。ready( function (){
$( #dgInvoice)。tablesorter();
});
< / script>
解决方案
.ajax({
type: POST,
url:weburl,
data: JSON .stringify(jsonData),
contentType: application / json; charset = utf-8 ,
dataType: json,
成功: OnSuccess,
失败: function (响应){
alert( 失败: + response.d);
},
错误: function (回复){
alert( 错误: + response.d);
}
});
return false ;
}
function OnSuccess(响应){
// alert(response.d);
var xmldoc =
.parseXML(response.d);
var xml =
(xmldoc);
var InvAuth = xml.find( 表跨度>);
// 从gridview的最后一行创建一个新行
var row =
i have tried binding in juery it was successful,but not sorting for binding and i used web service for sorting i have used plugging in js file tablesort.js
What I have tried:
i have tried binding in juery it was successful,but not sorting for binding and i used web service for sorting i have used plugging in js file tablesort.js
<pre> <script language="javascript" type="text/javascript">
window.onload = function() {
fnLoading_Start();
var jsonData = {};
jsonData.TRANSTYPE = "II"
var weburl = "../../UI/ws/ws_Accounts.asmx/ACC_INV_PRINT_AUTHORISATION";
JSON.stringify(jsonData);
$.ajax({
type: "POST",
url: weburl,
data: JSON.stringify(jsonData),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function(response) {
alert("Failure : " + response.d);
},
error: function(response) {
alert("Error : " + response.d);
}
});
return false;
}
function OnSuccess(response) {
// alert(response.d);
var xmldoc = $.parseXML(response.d);
var xml = $(xmldoc);
var InvAuth = xml.find("Table");
//create a new row from the last row of gridview
var row = $("[id*=dgInvoice] tr:last-child").clone(true);
//remove the lst row created by binding the dummy row from code behind on page load
$("[id*=dgInvoice] tr").not($("[id*=dgInvoice] tr:first-child")).remove();
//Look for the Hidden Field and fetch the CustomerId.
$.each(InvAuth, function() {
var InvAuth = $(this);
$("td", row).eq(1).html($(this).find("TRNS_TYPE").text());
$("td", row).eq(2).html($(this).find("INV_CRTNO").text());
$("td", row).eq(3).html($(this).find("INV_CRTDT").text());
$("td", row).eq(4).html($(this).find("CREATEDBY").text());
$("td", row).eq(5).html($(this).find("INV_CRT_DAT").text());
$("td", row).eq(6).html($(this).find("CLIENTNAME").text());
$("td", row).eq(7).html($(this).find("TOTAL_AMT").text());
$("[id*=dgInvoice]").append(row);
row = $("[id*=dgInvoice] tr:last-child").clone(true);
});
fnLoading_Stop();
}
$(document).ready(function() {
$("#dgInvoice").tablesorter();
});
</script>
解决方案
.ajax({ type: "POST", url: weburl, data: JSON.stringify(jsonData), contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccess, failure: function(response) { alert("Failure : " + response.d); }, error: function(response) { alert("Error : " + response.d); } }); return false; } function OnSuccess(response) { // alert(response.d); var xmldoc =
.parseXML(response.d); var xml =
(xmldoc); var InvAuth = xml.find("Table"); //create a new row from the last row of gridview var row =
这篇关于是否可以使用jquery绑定和排序gridview?任何人都可以帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文