EasyUI Forum
September 19, 2021, 10:50:17 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] maskedbox: how change mask without recreate ?  (Read 98 times)
Coder
Jr. Member
**
Posts: 82


View Profile
« on: September 08, 2021, 10:23:39 AM »

Code:
 $('#Lat').maskedbox({
         label: 'Lat:'
        ,labelPosition: 'left'
        ,labelAlign: 'right'
        ,width: 300
        ,promptChar: '0'
        ,mask: '+99 99 99'
        ,masks: {'9':'[0-9]','+':'[\+\-]'}
        ,onChange: LatChange
        ,required:true
        ,validType:{GIS:['Lat']}
        ,buttonIcon: 'fas fa-map-marker-alt greentext'
        ,onClickButton: getLast
      });
  ...
  $('#Lat').maskedbox('button').tooltip({position: 'top',content: 'get last known position'});

 GIS format changer:
Code:
let nVal = '+99 99.9999';
 $('#Lat').maskedbox({mask:nVal,masks: {'9':'[0-9]','+':'[\+\-]'}}).maskedbox('initValue','+')

then in console

Quote
VM5213:2890 Uncaught TypeError: Cannot read properties of undefined (reading 'tip')
    at Object.tip (<anonymous>:2890:31)
    at jQuery.fn.init.$.fn.tooltip (<anonymous>:2872:34)
    at HTMLInputElement.onShow (<anonymous>:7553:9)
    at <anonymous>:2822:13

trying

Code:
   if(($('#Lat').maskedbox('button')).hasClass('tooltip-f')
    ){
       $('#Lat').maskedbox('button').tooltip('destroy');
    };
   let nVal = '+99 99.9999';
   $('#Lat').maskedbox({mask:nVal,masks: {'9':'[0-9]','+':'[\+\-]'}}).maskedbox('initValue','+')
   $('#Lat').maskedbox('button').tooltip({position: 'top',content: 'get last known position'});

but get same error ...

do not get Uncaught TypeError only if don't create tooltip on button Wink
« Last Edit: September 12, 2021, 03:30:09 PM by Coder » Logged
Coder
Jr. Member
**
Posts: 82


View Profile
« Reply #1 on: September 08, 2021, 01:42:17 PM »

Logged
jarry
Administrator
Hero Member
*****
Posts: 2003


View Profile Email
« Reply #2 on: September 09, 2021, 12:30:18 AM »

Please try to call this code instead.
Code:
var opts = $('#Lat').maskedbox('options');
opts.mask = '+99 99.9999';
opts.masks = {'9':'[0-9]','+':'[\+\-]'};
$('#Lat').maskedbox('initValue','+');
Logged
Coder
Jr. Member
**
Posts: 82


View Profile
« Reply #3 on: September 12, 2021, 03:29:52 PM »

its work, thnx!
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!