Click here to Skip to main content
16,007,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

JavaScript
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???
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



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