PreOpen event for Bubble edit check field name

PreOpen event for Bubble edit check field name

lcoglcog Posts: 24Questions: 5Answers: 0

I am using the Bubble feature of the Editor. In the PreOpen event handler I am attempting to access the field name the Bubble event is called for, but I cannot seem to get the field name. I tried using the ".displayed()" function of the Editor, but it returned 0 entries. Is there something else I can try or am I missing something? Thank you.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin

    Hi,

    The issue with using displayed() in preOpen is that it is based on what fields are actually visible, and there aren't any at that point.

    Is using the open event valid for you? displayed() will work there.

    Allan

  • lcoglcog Posts: 24Questions: 5Answers: 0

    For certain fields I do not want to display the Bubble editor, can I do that from the "open" event? That is why I thought PreOpen would be good. I don't have to use "displayed()", is there something else I can use in PreOpen to figure out what column is going to be edited?

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin

    I see. Could you just not call the bubble() method on the column cells that you don't want to be bubble editable? This example shows inline editing applied to specific examples only, but the same could be applied to bubble editing.

    Allan

  • lcoglcog Posts: 24Questions: 5Answers: 0

    I will try that. I could set up a className and assign it when creating the field? Then reference that className in the jQuery selector? And the setting of the 'click' event needs to happen after the table has been created, in the "document ready" area, correct? Thank you.

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin

    Yes - that is one way of doing it. Use columns.className to assign the classes you want the event selector to match - e.g. bubbleEdit. Basically exactly the same as the example but calling bubble() rather than inline().

    Allan

  • lcoglcog Posts: 24Questions: 5Answers: 0

    When I look at the elements on the page it appears to me I have a Class set (“ZZZ”) on a table cell:

    But when I look for it through jQuery selector it doesn’t seem to find it:

    Based upon the example I believe I am doing everything properly, am I missing a step?

  • lcoglcog Posts: 24Questions: 5Answers: 0

    I think I have this working using the className with 1 problem: I am using "fixedColumns" for 2 columns and the bubble edit will not work for the fixed columns until I get into the "New" popup or the "all fields Edit" popup.

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
    Answer ✓
    $('table.dataTable tbody').on( 'click', 'td.ZZZ', function () {
      editor.bubble( this );
    } );
    

    You need to use a delegated event and also a non-table specific (id) selector if you are using FixedColumns, otherwise the selector won't pick up the cells in the fixed column.

    Allan

  • lcoglcog Posts: 24Questions: 5Answers: 0

    Thank you. I will test that now.

This discussion has been closed.