Access hidden column(s) for Inline Edit

Access hidden column(s) for Inline Edit

j.agnewj.agnew Posts: 1Questions: 1Answers: 0
edited July 2022 in Free community support

Hi, I have two hidden columns that I need to pass to my server. I can get the actual column that I need to update, but not the hidden ones that I need to use to query my DB with so I know which ones to update.

I assume I can use the API, but cannot find an example. Thanks!

function Editor() {
    PDS.Editor = new $.fn.dataTable.Editor({
        ajax: "/Report/SaveAdvertisingSpend",
        table: "#grid",
        idSrc: 'cell.RowId',
        fields: [
            {
                label: "",
                name: "cell.AdvertisingSpendAmount" // Can see and get this value.
            },
            {
                label: "",
                name: "cell.OrderMonth" // Hidden, cannot see.
            },
            {
                label: "",
                name: "cell.OrderYear" // Hidden, cannot see.
            },
        ]
    });
}

$('#grid').on('click', 'tbody td.editable',
    function() {
        PDS.Editor.inline(this,
            {
                buttons: {
                    label: '>', fn: function () { this.submit(); }

                }
            });
    });

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    You should be able to use the form-options to set submit to be 'allifChanged' - something like:

            PDS.Editor.inline(this,
                {
                    buttons: {
                        label: '>', fn: function () { this.submit(); }
                    },
                    submit: 'allIfChanged'
                });
    

    Please let us know if that doesn't do the trick,

    Colin

Sign In or Register to comment.