Premium support for our pure JavaScript UI components


Post by pincherhgz »

situation (we created that as an internal test case):

we create a panel via:

async function generateShowView(objectNode,form,initiatingElement){
      var tabPanelItems = getTabPanelItems(objectNode,form);
      // in case of read only we do not set the save button
      var tbarItems = {};
      if (!(eciDreadOnly === true)){
        tbarItems.save = {icon    : 'b-fa-save',tooltip : Ext.application.hummingbirdApi.getLocalized('Save content'),onClick : 'up.onSaveButtonClick'};
        var readOnlyText = '';
      } else {
        var readOnlyText = ' (' + Ext.application.hummingbirdApi.getLocalized('read only') + eciDalreadyInUse + ')';
      }
      let itemDetail = new bryntum.grid.Panel({
        title:objectNode.classIdentifier + ': ' + Ext.application.hummingbirdApi.getLocalized(objectNode.objectName) + readOnlyText,
        floating:true,
        maxHeight:'90%',
        width:'50%',
        modal:true,
        draggable:true,
        tbar : {
            items : tbarItems
        },
        tools    : {
            destroy : {
                cls : 'b-fa b-fa-times',
                handler : 'up.onPanelCloseClick',
                tooltip : Ext.application.hummingbirdApi.getLocalized('Close this Panel')
            }
        },
        onPanelCloseClick(e, panel) {
            unRegisterProtectApplication();
            panel.destroy();
        },
        items      : [
          {
              type:'tabpanel',
              floating:true,
              items: tabPanelItems
          }
        ],
        onSaveButtonClick({ source : button }) {
          saveObjectNode(objectNode);
          itemDetail.destroy();
        }
      });
      itemDetail.showBy({target:initiatingElement,anchor:true});
    }

we call that function more than one time, every time with different text set, always the panel is destroyed on entering the function and recreated, but the content that is shown is that one of the first panel


Post by alex.l »

HI pincherhgz,

Is it ExtGantt or vanilla Gantt? Did you try it with our examples?
Did you inspect DOM, maybe it's aligned on same position because you call https://bryntum.com/products/gantt/docs/api/Core/widget/Widget#function-showBy , so it align every new panel on same position?

All the best,
Alex


Post by pincherhgz »

hi, we are using vanilla gantt and yes, all the panels are positioned at the same place. When we set a breakpoint it correctly destroys and shows up with the new contents


Post by alex.l »

All the best,
Alex


Post by pincherhgz »

but the question is if i always destroy the existing before creating the next one ?


Post by alex.l »

Ah, sorry, I missed that moment in your description.
Could you please provide runnable code to reproduce this problem? That might be some race condition thing that we need to debug at runtime, but I cannot run your code.

All the best,
Alex


Post by pincherhgz »

it seams that the problem is caused by destroying and creating directly one after the other in the async function. We changed now to have the panel in a popup, no need for async, and that way the destroy/create works


Post by alex.l »

Great to hear you managed that!

All the best,
Alex


Post Reply