Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82602

Editor - getting id of row from within fixedColumn

$
0
0

I have a fixed column (left and right) with an edit button in the right column. I also have inline edting - which works 100%.

All is well and the click on the button is fired but shows an empty modal rather than with fields in. I suspect that this is due to the way fixed columns work.

The 'create' button works 100% - so editor is configured fine.

Question: How to correctly obtain the row to edit from an edit link in a fixedColumn.

Debugger: http://debug.datatables.net/awemar

Code for the Editor:

editorBDM = new $.fn.dataTable.Editor( {
        ajax: "/site_mods/bd/bd_fulllist_server.php",
        table: "#bdmlist_1",
        fields: [ {
                label: "Agent Company Name:",
                name: "agents.ag_name"
            }, {
                label: "Telephone Number:",
                name: "agents.ag_tel"
            }, {
                label: "Primary Contact Name:",
                name: "agents.ag_primary_contact"
            }, {
                label: "Email Address:",
                name: "agents.ag_email"
            }, {
                label: "Agent Town:",
                name: "agents.ag_town"
            }, {
                label: "Agent County:",
                name: "agents.ag_county"
            }, {
                label: "Existing Notes:",
                name: "agents.ag_notes"
            }, {
                label: "Record Status:",
                name: "agents.ag_status"
            }, {
                label: "BDM Responsible:",
                name: "agents.ag_bdm"
            }, {
                label: "Agents Website:",
                name: "agents.ag_website"
            }
        ]
    } );

The event:

// Edit record
    $('#bdmlist_1').on('click', 'a.editor_edit', function (e) {
        e.preventDefault();

        console.log($(this).closest('tr'));
        editorBDM.edit( $(this).closest('tr'), {
            title: 'Edit record',
            buttons: 'Update'
        } );
    } );

The Inline activation: (which works 100%)

// Activate an inline edit on click of a table cell
    $('#bdmlist_1').on( 'click', 'tbody td:not(:last-child)', function (e) {
        editorBDM.inline(this,{
            onBlur: 'submit'
        });
    } );

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


Viewing all articles
Browse latest Browse all 82602

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>