使用jQuery jtable的问题 [英] problem in working with jQuery jtable
问题描述
亲爱的所有人,您好
我正在使用我的ASP.Net Web表单项目中的jQuery jTable,
但我有一些问题
在loadCustomers函数的'listAction'中的
我得到客户列表,然后我添加了自定义按钮'btnLoadPay',我想要为此,当用户点击此按钮时,loadPaysForCustomer调用然后获得所选客户的付款
我们的功能
< pre lang =Javascript> function loadCustomers(){
$(' #Customers')。jtable({
title:' 客户列表',
分页: true ,
排序: false ,
jqueryuiTheme: true ,
pageSize: 5 ,
gotoPageArea:' combobox',
动作:{
listAction:' manageCustomers.aspx / loadCustomers'
} ,
工具栏:{
项目:[{
工具提示:' 点击此处将此表导出为excel',
text:' ZZZ',
点击: function (){
alert(' 此项目只是新工具栏功能的演示。您可以在此处添加自定义工具栏项。然后,例如,当用户单击此项时,您可以从服务器下载excel文件。有关用法,请参阅API参考文档中的工具栏。');
}
}]
},
字段:{
CustomerID:{
key: true ,
create: false ,
edit: false ,
list: false
},
DocumentNo:{
},
CustomerFirstName:{
},
CustomerLastName:{
},
IDNumber:{
visibility:' 隐藏'
},
NationalNo:{
},
用户名:{
visibility:' hidden'
},
FatherName:{
visibility:< span class =code-string>' hidden'
},
btnLoadPay:{
display:< span class =code-keyword> function (data){
return ' < button type =buttononclick =loadPaysForCustomer(\'' + data.record.CustomerID + ' \'); return false;> get Pays< / button>';
}
}
}
});
$( #Customers')。jtable(' load');
}
function loadPaysForCustomer(CustomerID){
alert(CustomerID);
$(' #Pays') .jtable({
title:' 客户付款清单',
分页: true ,
排序: false ,
jqueryuiTheme: true ,
pageSize: 5 ,
gotoPageArea:' combobox',
action s:{
listAction:' manageCustomers.aspx / loadCustomerPay' + ?CustomerID = + CustomerID + & Project_ID = 10
},
字段:{
ID:{
key: true ,
create: false ,
edit: false ,
list: false
},
类型:{
create: false ,
edit: false ,
list: false
},
ShowType:{},
日期:{},
扫描:{},
付款方式:{}
}
});
$(' #Pays')。jtable(' load');
CustomerID = 0 ;
return false ;
}
每次点击'get Pays'按钮上的用户
,'loadPaysForCustomer'正确提醒客户ID,但是在loadPaysForCustomer'函数的listAction方法的url中,CustomerID是用户点击的第一个CustomerID。
如何解决这个问题?
(' #Customers')。jtable({
title:' Customer List',
paging: true ,
排序: false ,
jqueryuiTheme: true ,
pageSize: 5 ,
gotoPageArea:' combobox',
操作:{
listAction: ' manageCustomers.aspx / loadCustomers'
},
toolbar:{
items:[{
工具提示:' 点击此处将此表导出为excel',
text:' ZZZ',
点击: function (){
alert(' 此项目只是新工具栏功能的演示。您可以在此处添加自定义工具栏项。然后,例如,当用户单击此项时,您可以从服务器下载excel文件。有关用法,请参阅API参考文档中的工具栏。');
}
}]
},
字段:{
CustomerID:{
key: true ,
create: false ,
edit: false ,
list: false
},
DocumentNo:{
},
CustomerFirstName:{
},
CustomerLastName:{
},
IDNumber:{
visibility:' 隐藏'
},
NationalNo:{
},
用户名:{
visibility:' hidden'
},
FatherName:{
visibility:< span class =code-string>' hidden'
},
btnLoadPay:{
display:< span class =code-keyword> function (data){
return ' < button type =buttononclick =loadPaysForCustomer(\'' + data.record.CustomerID + ' \'); return false;> get Pays< / button>';
}
}
}
});
(' #Customers')。jtable(' load');
}
function loadPaysForCustomer (CustomerID){
alert(CustomerID);
(' #Pays')。jtable({
title:' 客户付款清单',
分页: true ,
排序: false ,
jqueryuiTheme: true ,
pageSize: 5 ,
gotoPageArea: combo box',
操作:{
listAction:' manageCustomers.aspx / loadCustomerPay ' + ?CustomerID = + CustomerID + & Project_ID = 10
},
字段:{
ID:{
键: true ,
创建: false ,
编辑: false ,
list: false
},
类型:{
create: false ,
edit: false ,
list: false
},
ShowType:{},
日期:{},
扫描:{},
付款方式:{}
}
});
Dear All, Hi
i'm working with jQuery jTable in my ASP.Net Web Form project,
but i have some problem
in 'listAction' of loadCustomers function i'm get the list of Customers, then i'm added the custom button 'btnLoadPay', i'm want to do this, when user clicked on this button the loadPaysForCustomer called and then get the Pays of selected Customer
there us my functions
function loadCustomers() {
$('#Customers').jtable({
title: 'Customer List',
paging: true,
sorting: false,
jqueryuiTheme: true,
pageSize: 5,
gotoPageArea: 'combobox',
actions: {
listAction: 'manageCustomers.aspx/loadCustomers'
},
toolbar: {
items: [{
tooltip: 'Click here to export this table to excel',
text: 'ZZZ',
click: function () {
alert('This item is just a demonstration for new toolbar feature. You can add your custom toolbar items here. Then, for example, you can download excel file from server when user clicks this item. See toolbar in API reference documentation for usage.');
}
}]
},
fields: {
CustomerID: {
key: true,
create: false,
edit: false,
list: false
},
DocumentNo: {
},
CustomerFirstName: {
},
CustomerLastName: {
},
IDNumber: {
visibility: 'hidden'
},
NationalNo: {
},
UserName: {
visibility: 'hidden'
},
FatherName: {
visibility: 'hidden'
},
btnLoadPay: {
display: function (data) {
return '<button type="button" onclick="loadPaysForCustomer(\'' + data.record.CustomerID + '\'); return false;">get Pays</button> ';
}
}
}
});
$('#Customers').jtable('load');
}
function loadPaysForCustomer(CustomerID) {
alert(CustomerID);
$('#Pays').jtable({
title: 'Customer pay list',
paging: true,
sorting: false,
jqueryuiTheme: true,
pageSize: 5,
gotoPageArea: 'combobox',
actions: {
listAction: 'manageCustomers.aspx/loadCustomerPay' + "?CustomerID=" + CustomerID + "&Project_ID=10"
},
fields: {
ID: {
key: true,
create: false,
edit: false,
list: false
},
Type: {
create: false,
edit: false,
list: false
},
ShowType: {},
Date: {},
Scan: {},
Payment: {}
}
});
$('#Pays').jtable('load');
CustomerID = 0;
return false;
}
on every click of user on the 'get Pays' button, the 'loadPaysForCustomer' alert the CustomerID correctly, but in url of listAction method of loadPaysForCustomer' function, CustomerID is first CustomerID of user clicks.
how can i solve this problem???
('#Customers').jtable({ title: 'Customer List', paging: true, sorting: false, jqueryuiTheme: true, pageSize: 5, gotoPageArea: 'combobox', actions: { listAction: 'manageCustomers.aspx/loadCustomers' }, toolbar: { items: [{ tooltip: 'Click here to export this table to excel', text: 'ZZZ', click: function () { alert('This item is just a demonstration for new toolbar feature. You can add your custom toolbar items here. Then, for example, you can download excel file from server when user clicks this item. See toolbar in API reference documentation for usage.'); } }] }, fields: { CustomerID: { key: true, create: false, edit: false, list: false }, DocumentNo: { }, CustomerFirstName: { }, CustomerLastName: { }, IDNumber: { visibility: 'hidden' }, NationalNo: { }, UserName: { visibility: 'hidden' }, FatherName: { visibility: 'hidden' }, btnLoadPay: { display: function (data) { return '<button type="button" onclick="loadPaysForCustomer(\'' + data.record.CustomerID + '\'); return false;">get Pays</button> '; } } } });
('#Customers').jtable('load'); } function loadPaysForCustomer(CustomerID) { alert(CustomerID);
('#Pays').jtable({ title: 'Customer pay list', paging: true, sorting: false, jqueryuiTheme: true, pageSize: 5, gotoPageArea: 'combobox', actions: { listAction: 'manageCustomers.aspx/loadCustomerPay' + "?CustomerID=" + CustomerID + "&Project_ID=10" }, fields: { ID: { key: true, create: false, edit: false, list: false }, Type: { create: false, edit: false, list: false }, ShowType: {}, Date: {}, Scan: {}, Payment: {} } });
这篇关于使用jQuery jtable的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!