We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

getSelectedValue

Hi

getSelectedValue seems to return the watermark text value if there is no selected item - is that behaviour correct?

Regards
Jon

6 Replies

PO Prince Oliver Syncfusion Team October 26, 2016 07:07 AM UTC

Hi Jon,   
  
We were not able reproduce the issue. Please provide detailed information on your scenario along with code snippet or attach an issue reproducing sample.  This would help us to find the solution.  
  
Regards,   
Prince 



JE Jon E October 26, 2016 08:19 AM UTC

Hi Prince
Ah OK.  I think this is down to the way that I have been clearing drop downs.  For various reason I handle cascading myself and when a parent changes I need to clear the chilkd drop down fields.  That is all OK but I am having issues with how to properly clear the children.  How do you clear the selected value AND empty the drop down of it's items?

Many thanks

Jon


JE Jon E October 26, 2016 08:40 AM UTC

I've managed to clear the items by way of reapplying an empty array to the datasource in the absence of a full clearItems function.

Still need to work out the proper way to deselect all items.  There is an unCheckAll but no unselectall....


PO Prince Oliver Syncfusion Team October 27, 2016 07:02 AM UTC

Hi Jon,   
  
Thanks for your update.   
  
In order to deselect all the selected items in dropdownlist, you can make use of selectedItemIndex property. Set value -1 to selectedItemIndex property using setModel method.   
  
function clearAll(args) {   
          target.setModel({ selectedItemIndex-1 });   
        }   
  
  
Another way of unselecting all items is by using clearText method.   
  
function clearAll(args) {   
          target.clearText();   
        }   
  
  
We have attached a Playground Sample for your convenience.   
  
Please let us know if you need more clarifications.  
  
Regards,   
Prince  



JE Jon E October 27, 2016 12:51 PM UTC

Hi Prince,
Great thanks for that.  It has allowed me to complete that segment of the code now :)
Regards

Jon


PO Prince Oliver Syncfusion Team October 28, 2016 09:21 AM UTC

Hi Jon,   
  
Most welcome.  
  
We are glad to hear your issue has fixed.   
  
Regards,   
Prince   


Loader.
Live Chat Icon For mobile
Up arrow icon