Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

i have a table (generated in asp.net) displayed with the great DataTable jQuery plugin. My table have some editable fields (i used jQuery Datatables editable) and i already have some custom fields in some of my tables.

This is a table with only 3° column editable that sends two extra parameters (column 3 and 1 of my table): "cell" and "trustedid". This works perfectly:

$('#ctl00_MainContent_tradGrid').dataTable({
    bJQueryUI: true,
    "sPaginationType": "full_numbers",
    "bSortClasses": false
    }).makeEditable({
        sUpdateURL: "/updateData.aspx<% Response.Write(parameters); %>",
        fnOnEditing: function (input) {
            cell = input.parents("tr")
                    .children("td:nth-child(3)")
                    .text();
            trustedid = input.parents("tr")
                    .children("td:nth-child(1)")
                    .text();
            return true
        },
        oUpdateParameters: {
            cell: function () { return cell; },
            trustedid: function () { return trustedid; }
        },
        oEditableSettings: { event: 'click' }
    });

i also have another table with checkboxes on last editable column, and works fine too, this is the code:

$('#ctl00_MainContent_tradGrid').dataTable({
    bJQueryUI: true,
    "sPaginationType": "full_numbers",
    "bSortClasses": false
}).makeEditable({
    sUpdateURL: "/updateChecked.aspx",
    aoColumns: [
        {}, {}, {}, {
            type: 'checkbox',
            submit: 'Ok',
            cancel: 'Cancel',
            checkbox: { trueValue: 'Yes', falseValue: 'No' }
        }
    ]
});

now i need to use a single custom parameter in this second example, but can't do it! This is my try:

$('#ctl00_MainContent_tradGrid').dataTable({
    bJQueryUI: true,
    "sPaginationType": "full_numbers",
    "bSortClasses": false
}).makeEditable({
    sUpdateURL: "/updateChecked.aspx",
    fnOnEditing: function (input) {
        trustedid = input.parents("tr")
                .children("td:nth-child(1)")
                .text();
        return true
    },
    oUpdateParameters: {
        trustedid: function () { return trustedid; }
    },
    aoColumns: [
        {}, {}, {}, {
            type: 'checkbox',
            submit: 'Ok',
            cancel: 'Cancel',
            checkbox: { trueValue: 'Yes', falseValue: 'No' }
        }
    ]
});

but it get the error: Uncaught ReferenceError: trustedid is not defined

How can i do this?

share

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.