EasyUI Forum
April 25, 2024, 12:55:58 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] The title attribute for Combobox is not working  (Read 6744 times)
hmdat
Newbie
*
Posts: 6


View Profile
« on: April 17, 2018, 06:55:30 AM »

I have one combobox with the label at the left side, but it's obscured a part.

And I want when the mouse is on the label, it show full text. So, I tried set the 'title' attribute, but it's not working.

Code:
Code:
<select class ="easyui-combobox" type="text" id="conditionForm_orgName" name="conditionForm_orgName" title="Organizaiton Name" style="width: 90%;height: 22px" data-options="label:' Organizaiton Name ',panelHeight:'auto',panelMaxHeight:'200',required:false,editable: false"/>

How can I fix this ?

Thanks.
« Last Edit: April 19, 2018, 07:03:49 PM by hmdat » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: April 17, 2018, 06:26:52 PM »

You can set the 'labelWidth' property to a bigger value.
Code:
label: 'Organizaiton Name:',
labelWidth: 150
Logged
hmdat
Newbie
*
Posts: 6


View Profile
« Reply #2 on: April 17, 2018, 08:39:20 PM »

Dear Jarry,
Many thanks for your reply, but beside this solution, if it is possible to make the title attribute work, or the combobox plugin didn't support this ?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: April 18, 2018, 02:00:27 AM »

You can also call 'label' method to get the label object and then set the 'title' attribute for it.
Code:
var label = $('#conditionForm_orgName').combobox('label');
label.attr('title', 'Organizaiton Name');
Logged
hmdat
Newbie
*
Posts: 6


View Profile
« Reply #4 on: April 18, 2018, 05:30:52 AM »

Dear Jarry,
Actually before ask this question, I have tried search, and also found an your answer for change label for textbox follow link:
https://www.jeasyui.com/forum/index.php?topic=6843.0

Your code works for textbox, but for combobox:
If I tried put this javascript segment in
Code:
$(document).ready(function(){ .......});
, it doesn't work.

If I put code in onBeforeLoad event of combobox, it works:


Code:
<select class ="easyui-combobox" type="text" id="conditionForm_orgName" name="conditionForm_orgName" style="width: 90%;height: 22px" data-options="label:' Organizaiton Name ', panelHeight:'auto', panelMaxHeight:'200', required:false, editable: false, onBeforeLoad:function(){.....<java script code to change label>......}"/>


Generally, this solution also good, but I wonder if any better solution, like we can extend the 'title' attribute for combobox and re-write for it, but I'm not sure how to do ?
« Last Edit: April 18, 2018, 05:32:45 AM by hmdat » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #5 on: April 19, 2018, 05:03:33 PM »

The example works fine on combobox components.  

http://code.reloado.com/ukiwoj4/edit#html,live

Another way to attach the 'title' attribute is to wrap the 'label' with a '<span>' element.
Code:
    <select class ="easyui-combobox" type="text" id="conditionForm_orgName" name="conditionForm_orgName" style="width: 200px;height: 22px" data-options="label:'<span title=\'Organizaiton Name\'>Organizaiton Name</span> ',panelHeight:'auto',panelMaxHeight:'200',required:false,editable: false"/>

« Last Edit: April 19, 2018, 05:05:18 PM by jarry » Logged
hmdat
Newbie
*
Posts: 6


View Profile
« Reply #6 on: April 19, 2018, 07:02:16 PM »

Hi Jarry,
I have known the reason why it didn't work.
My combox was in one iframe, I tried changed put
Code:
var label = $('#conditionForm_orgName').combobox('label');
label.attr('title', 'Organizaiton Name');

in
Code:
$(window).load(function(e) {....} 
and it works.

Also your solution with using the <span> is very DELICATE and PERFECT, that is what I need.

Thank you billion times, Jarry!
« Last Edit: April 19, 2018, 07:47:50 PM by hmdat » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!