Inline editing with hidden editor fields

Inline editing with hidden editor fields

cj1005cj1005 Posts: 142Questions: 45Answers: 1

Hi,

I've just enabled inline editing on my project and it is amazing :smile:

But, I have one little issue, on some of my editor custom forms, I programmatically hide fields that I do not want to be edited but I need to submit to the server upon editing.

I hide fields using code like below:

Projects_editor.hide('projects.proj_id');

And I enable inline editing using the following code:

        // Inline editing
        $('#dtProjects').on( 'dblclick', 'tbody td', function () {
            Projects_editor.inline( this, {
                submitOnBlur: true
            } );
        } );

My question is can I add a condition that checks if the td being edited is hidden or not?
Or maybe even better can I check the object is a member of a certain class, that way I can add even more control to which fields are inline editable?

Cheers, Chris

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,950Questions: 87Answers: 416
    Answer ✓

    This example allows editing certain table rows only and within those rows you can edit certain clolums only:

    // Activate an inline edit on click of a table cell
    $('#tblCashFlow').on( 'click', 'tbody tr.inlineRepaymentInterest td.inlineCashFlow',
        function (e) {
            cashFlowEditor.inline( this, {
                onBlur: 'submit'
            } );
    } );
    

    Using rowCallback (you'll find that in the docs) I set the class for those rows that qualify for editing:

    $(row).addClass('inlineRepaymentInterest');
    

    Using columnDefs (in the docs as well) I assign the class for the column based on a class I set in the HTML of the data table:

    { targets: "repaymentInterest", className: "inlineCashFlow" },
    

    And, yes: targets can be classes:

    And this is the HTML:

    <th class="repaymentInterest"><?php echo $en?('Repayment / Amt. Change'):('Tilgung / Betrags-änderung');?></th>
    <th class="repaymentInterest"><?php echo $en?('Interest'):('Zinsen');?></th>
    
  • cj1005cj1005 Posts: 142Questions: 45Answers: 1

    Thank you, this is exactly what I need :smile:

This discussion has been closed.