Jump to content

Убрать перенос строк в uniListBox


x11

Recommended Posts

Подскажите, пожалуйста, как убрать перенос текста у строк в TuniListBox?

И еще, как убрать нижнюю полосу прокрутки?

Спасибо.

Screenshot_11.jpg

Link to comment
Share on other sites

Еще вопрос.

Т.к. весь текст будет скрыт, то можно ли сделать так, чтобы на каждую строку былая своя всплывающая подсказка, чтобы в ней был полный текст строки?

Спасибо.

Link to comment
Share on other sites

46 minutes ago, x11 said:

Т.к. весь текст будет скрыт, то можно ли сделать так, чтобы на каждую строку былая своя всплывающая подсказка, чтобы в ней был полный текст строки?

Попробуйте:

function beforeInit(sender, config)
{
    config.listConfig = {
        tpl: new Ext.XTemplate('<tpl for="."><li style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" title="{val}" role="option" unselectable="on" class="x-boundlist-item">{val}</li></tpl>')
    }
}

 

  • Thanks 1
Link to comment
Share on other sites

Суппппер!

Почти то, что надо. Осталось скрыть нижнюю полосу прокрутки.

Я, честно говоря, слегка удивлен, что у листбокса нет свойства, отвечающего за полосы прокрутки.

Link to comment
Share on other sites

26 minutes ago, x11 said:

Такс... не совсем супер. Возникли проблемы. Исчезли чекбоксы и мультивыбор.

Да, простите, при использовании чекбокса - да, там используется другой template, а мы перезаписываем (Хотя с мультивыбором я не увидел проблему).

Link to comment
Share on other sites

3 minutes ago, x11 said:

невозможно выбрать ни единой строки и свойство SelCount всегда возвращает 0

Ok. Тогда можно попробовать применить CSS, но мне кажется, для аттрибута title, нужно будет искать другое решение. 

Link to comment
Share on other sites

49 minutes ago, Sherzod said:
function beforeInit(sender, config)
{
    config.listConfig = {
        tpl: new Ext.XTemplate('<tpl for="."><li style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" title="{val}" role="option" unselectable="on" class="x-boundlist-item">{val}</li></tpl>')
    }
}

function beforeInit(sender, config)
{
    config.listConfig = {
        tpl: new Ext.XTemplate('<tpl for="."><li style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" title="{val}" role="option" unselectable="on" class="x-boundlist-item">{val}</li></tpl>')
    }
}

1. LayoutConfig -> Cls = customList

2. 

.customList .x-boundlist-item {
  overflow: hidden; 
  text-overflow: ellipsis; 
  white-space: nowrap;
}

 

  • Thanks 1
Link to comment
Share on other sites

32 minutes ago, x11 said:

ну хотя бы без title

 

35 minutes ago, Sherzod said:

но мне кажется, для аттрибута title, нужно будет искать другое решение

function afterrender(sender, eOpts)
{
    sender.tip = Ext.create('Ext.tip.ToolTip', {
        target: sender.el,
        delegate: '.x-boundlist-item',
        listeners: {
            beforeshow: function updateTipBody(tip) {
                tip.update(Ext.get(tip.triggerElement).dom.innerText);
            }                
        }
    });
}

 

  • Thanks 1
Link to comment
Share on other sites

54 minutes ago, x11 said:

ну хотя бы без title...

Показ всплывающей подсказки, только тогда, когда текст обрезается:

function afterrender(sender, eOpts)
{
    sender.tip = Ext.create('Ext.tip.ToolTip', {
        target: sender.el,
        delegate: '.x-boundlist-item',
        listeners: {
            beforeshow: function updateTipBody(tip) {
                var tm = new Ext.util.TextMetrics(); 
                var _width = tm.getSize(Ext.get(tip.triggerElement).dom.innerText).width;
                
                var _someValueToAddWidth = 44;
                
                if (_width+_someValueToAddWidth >= sender.getWidth()) {
                    tip.update(Ext.get(tip.triggerElement).dom.innerText);
                } else {
                    return false;
                }
            }                
        }
    });
}

 

  • Thanks 1
Link to comment
Share on other sites

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...