Jump to content

Recommended Posts

Posted

Добрый день!

Я использую этот код для отображения кнопки и вывода в подсказку содержимое поля

Все работает, но не могу подсказку расположить слева от кнопки, всегда выводится справа, хотя указал так sender.tip.showBy(btn, 'br-tr?', [0, 0]);

Что я делаю не так ?

function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
{
  columns[2].renderer = function(value, metadata, record)
  {
    var buttonId = Ext.id('btn-');
    Ext.defer(function()
    {
      var btn = Ext.get(buttonId);
      if(btn)
      {
        btn.on('click', function(e)
        {
          e.stopEvent();
          if(sender.tip)
          {
            sender.tip.destroy();
          }
          sender.tip = new Ext.tip.ToolTip(
          {
            target: btn,
            html: Ext.util.Format.htmlEncode(record.get('1')),
            width: 300,
            autoHide: false,
            closable: true,
            bodyStyle: 'user-select: text; padding: 10px; background-color:white;',
            draggable:
            {
              delegate: 'h1'
            },
            resizable:
            {
              dynamic: true,
              handles: 's e se'
            },
            listeners:
            {
              destroy: function()
              {
                btn.tip = null;
              }
            }
          });
          sender.tip.showBy(btn, 'br-tr?', [0, 0]);
        });
      }
    }, 50);
    return '<div style="display:flex;">' +

               '<div style="flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding-right:8px;">' + value + '</div>' +

               '<button id="' + buttonId + '" ' + 'style="flex-shrink:0; background:#4CAF50; color:white; border:none; border-radius:4px; padding:2px 8px; cursor:pointer; width:12px; height:12px;">' +

               '</button>' +

               '</div>';
  };
}

всегда выводится так

image.png.c8cb550d7adbc1a591ebc480c6215bc1.png

а хочу чтобы было так 

image.png.fbc083976db27b711891fd18363e1da0.png

 

 

Posted

Добрый день!

Попробуйте defaultAlign конфиг:

        ...
        sender.tip = new Ext.tip.ToolTip(
          {
            defaultAlign: 'br-tl',
            target: btn,
          ...

 

Posted
1 hour ago, Sherzod said:

Добрый день!

Попробуйте defaultAlign конфиг:

        ...
        sender.tip = new Ext.tip.ToolTip(
          {
            defaultAlign: 'br-tl',
            target: btn,
          ...

 

 

Так работает, Спасибо!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...