keep the Editor panel open on the page

keep the Editor panel open on the page

BTalayiBTalayi Posts: 18Questions: 4Answers: 0

Hi,

I'm using Always visible editing panel example on my page and I just want to know how to make the editor panel open all the time and not closing it. I tried to remove this line editor.close(); after saving the changes or creating a new row but didn't work. Which part of the code should be changed for that?

Thanks,

This question has an accepted answers - jump to answer

Answers

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

    The problem there would be what would you display if you deselect a row? You could flip to the create form, so you could try changing

            .on( 'deselect', function () {
                editor.close();
            } );
    

    to be

            .on( 'deselect', function () {
                editor.close();
                editor.create();
            } );
    

    Would that work?

    Colin

  • BTalayiBTalayi Posts: 18Questions: 4Answers: 0

    Hi Colin,

    Thank you for your response.

    I changed deselect function like this:

     .on('deselect', function () {
                editor.create({
                    title: 'Add new Asset tag information',
                    buttons: [
                        'Save',
                        {
                            label: 'Cancel',
                            fn: function () {
                                editor.close();
                            }
                        }
                    ]
                });
            });
    
    

    and it worked for edit and remove. the only part left is for "add new row". when page is loaded, user needs to click on the link to see the editor panel and add new row.
    but I want to have editor panel available from the beginning of page loading.
    I know that I need to listen to an event and run the editor.create() function. in my case table is empty at the beginning so I can't use table.draw event. Do you have any idea where should I add editor.create to make it visible when the page is loaded?

    Thanks

  • kthorngrenkthorngren Posts: 20,269Questions: 26Answers: 4,765
    Answer ✓

    Try initComplete or, if you prefer, the init event.

    Kevin

  • BTalayiBTalayi Posts: 18Questions: 4Answers: 0

    Thanks Kevin!
    It worked :)

This discussion has been closed.