Hide field in editor but show on bubble editing

Hide field in editor but show on bubble editing

kumamarikumamari Posts: 24Questions: 9Answers: 1

I'm trying to hide a field within my editor but when clicked on in my datatable, I want to show it on bubble editing. How would I achieve this? Here is my code.

Editor

{
    label: "Bid Increment:",
    name: "bid_increment",
    type: "hidden"
}

Datatable

{ 
    data: "bid_increment", 
    className: 'bid_increment' 
}

Bubble editor code

    $('#scratchTable').on( 'click', 'tbody td:not(:first-child)', function (e) {
        editor.bubble( this );
    } );

This question has an accepted answers - jump to answer

Answers

  • Tester2017Tester2017 Posts: 145Questions: 23Answers: 17
    Answer ✓

    You can resolve this by using the following code, however, it is not complete as it will not hide the label of the field, but that is something you might be able now to resolve:

    editor.on( 'open', function ( e, type ) {
        // Type is 'main', 'bubble' or 'inline'
        switch (type)
        {
            case 'main':
                $('#DTE_Field_bid_increment').addClass('hidden');
                break;
    
            case 'bubble':
                $('#DTE_Field_bid_increment').removeClass('hidden');
                break;
    
            case 'inline':
                $('#DTE_Field_bid_increment').addClass('hidden');
                break;
        }
    } );
    

    This will hide your field when you open the editor or with inline editing, and it shows your field with bubble editing. I have not tested it completely, but this is more or less a way how to achieve your goal.

  • kumamarikumamari Posts: 24Questions: 9Answers: 1

    Thank you for your help! I forgot about getting the type from the open event. :)

This discussion has been closed.