Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Get back dropdown selectedItem from outside of toggle callBack


Neo Andersson

Question

Hi

Can we get back somehow a dropdown selectedItem value from ouside of its ontoggle callback function?

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

assuming that you use the patch that updates the value

 

or you update the selectedItem in the handler

Please login or register to see this code.

 

You can create this function

Please login or register to see this code.

 

that will return the value.
Edited by jgab
  • Thanks 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • 32 minutes ago, jgab said:

    assuming that you use the patch that updates the value

     

    or you update the selectedItem in the handler

    Please login or register to see this code.

     

    You can create this function

    Please login or register to see this code.

    that will return the value.

    Unfortunatelly doesn't work. Tried both ways, with handler, without it..still nothing

    Link to comment
    Share on other sites

    • 0
    Just now, Neo Andersson said:

    Unfortunatelly doesn't work. Tried both ways, with handler, without it..still nothing

    Can you post a minimal example that doesn't work?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted (edited)
    3 minutes ago, jgab said:

    Can you post a minimal example that doesn't work?

    Please login or register to see this code.

    i Set UIHandler as for the dropdown onToggled callback, then i created a button showSelectedItem to log it out

    Edited by Neo Andersson
    Link to comment
    Share on other sites

    • 0

    Sorry, bug in QuickApp:getUIprop, fixed in post.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted (edited)
    6 minutes ago, jgab said:

    Sorry, bug in QuickApp:getUIprop, fixed in post.

    Okay, Jan is there a method to somehow force the dropdown to select the first option if i dont know the option value? In the example below someValue should be an existing value of the dropdown, but if i dont know it, as dropdown was filled dynamically, i need sometimes to make it show some element..

    I have several probelms with dropdown, as it sometimes just lost the focus, so the selectedItem returns nil, and as so my other part of the code, that is dependent on that item fails..so in cases when the dropdown looses focus, (despite of showing some element in UI it returns nil for selectedItem, i need to reClick it manually) i can artificially click on it to selecte the first existing element

    self:updateView("dd","selectedItem", someValue)

    Edited by Neo Andersson
    Link to comment
    Share on other sites

    • 0

    If you update the dropdown dynamically you use

    Please login or register to see this code.

    Then your options table is available in 

    Please login or register to see this code.

     

    and you can find the first value and set the selectedItem
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 2 minutes ago, jgab said:

    If you update the dropdown dynamically you use

    Please login or register to see this code.

    Then your options table is available in 

    Please login or register to see this code.

     

    and you can find the first value and set the selectedItem

    Wow....If i only knew what source you use to get these informatioins...fibaro officials have next to nothing about posiibilities thanks

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted (edited)
    7 minutes ago, Neo Andersson said:

    Wow....If i only knew what source you use to get these informatioins...fibaro officials have next to nothing about posiibilities thanks

    @jgab Jan kill me but this is sitll not working

     

    Please login or register to see this code.

     

    1 minute ago, Neo Andersson said:

    @jgab Jan kill me but this is sitll not working

     

    Please login or register to see this code.

     

    shouldn't you convert elmID to string before calling self.viewCache[elmID ?]

    Edited by Neo Andersson
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 22 minutes ago, Neo Andersson said:

    @jgab Jan kill me but this is sitll not working

     

    Please login or register to see this code.

     

    shouldn't you convert elmID to string before calling self.viewCache[elmID ?]

    Ahh i see, the button onReleased handler doesnt trigger, why?

     

    Link to comment
    Share on other sites

    • 0

    Do you get a warning?

    Please login or register to see this code.

     

    ...and it only works after you done the first selection (initially it returns nil)

    Edited by jgab
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 16 minutes ago, jgab said:

    Do you get a warning?

    Please login or register to see this code.

     

    ...and it only works after you done the first selection (initially it returns nil)

    no it doesn't log anything, and i made the click too but nothing..I tried just print a simple text but it is not triggered, also tried to remove onReleased handling from your handler to no affect the button click but still nothing

    3 minutes ago, Neo Andersson said:

    no it doesn't log anything, and i made the click too but nothing..I tried just print a simple text but it is not triggered, also tried to remove onReleased handling from your handler to no affect the button click but still nothing

     

     

    This callback for button doesnt even logs L is..nil or something..it just doesn't get there, if i leave there just the print part like pring("xxx") then it triggers

    Please login or register to see this code.

     

    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
    Answer this question...

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