How to Set values in kendo multiSelect

8 posts, 0 answers
  1. Suk
    Suk avatar
    15 posts
    Member since:
    Mar 2015

    Posted 14 Mar 2015 Link to this post

    I am new to kendo and I recently started coding in C#.net MVC. I have a JSON array in jsonObj(variable name), like for example:

    '[{"key":"Name","comparison":"Equals","values":["JOHN","LILY"]}]'

    Now, I want this jsonObj.values to be set into the kendo multiSelect on a button click. I can see the values in alert as JOHN,LILY .

    I coded:

    $("#DrugNames").data("kendoMultiSelect").value(jsonObj.values);
    $("#DrugNames").data("kendoMultiSelect").value(jsonObj.values.toString().split(','));

    But, it doesn't seem to work... I also tried using:

    $("#DrugNames").data("kendoMultiSelect").value(["JOHN","LILY"]);

    Still no success. Please help.
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2598 posts

    Posted 17 Mar 2015 Link to this post

    Hello Sukanya,

    The Kendo UI MultiSelect widget will accept an array of values for its value method. Please check the following sample and let me know if it helps:

    http://dojo.telerik.com/UpoHA

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Suk
    Suk avatar
    15 posts
    Member since:
    Mar 2015

    Posted 18 Mar 2015 in reply to Kiril Nikolov Link to this post

    Thank you Kiril for replying...

    But this doesn't seem to work. As I am really new to all this stuff, I am a bit confused.
    '[{"key":"Name","comparison":"Equals","values":["JOHN","LILY"]}]' is a string which comes from my DB. So, I changed it back to JSON array using $.parseJSON.
    The kendo multiselect is in a Kendo Window.What I wanted is if I had "Name" in the "key" portion, then just pick the "values" part and place it in the multiSelect just like the way you said, 
    multiselect.value(jsonObj.values); So, I guess I am not wrong about how to set the values in multiSelect. 

    Am I doing anything wrong with the Json thing?? Sorry if I am being naive. Thanks in advance.
  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2598 posts

    Posted 21 Mar 2015 Link to this post

    Hello Sukanya,

    Please check the following sample and let me know if it helps:

    http://dojo.telerik.com/AYIfa

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Nana
    Nana avatar
    1 posts
    Member since:
    May 2017

    Posted 18 May in reply to Kiril Nikolov Link to this post

    Hi,

    I am also new to Kindo and I am wondering if there is any way to re-add the selected items to the kendo multiselect (allow duplications)
    I tried tp get the selected items and hack the datasource of the multiselect but it works partially.
    There is a field in the kendoMultiSelect called _visibleitems so I guess the selected items are there in the datasource but they are just invisible, how can I make them visible?

    Thanks,
    Entisar
  6. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1117 posts

    Posted 23 May Link to this post

    Hi Entisar,

    Duplicating items in the MultiSelect is a topic that has been discussed on the forums. See Atanas' reply in this thread.

    Regards,
    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. entisar
    entisar avatar
    1 posts
    Member since:
    May 2017

    Posted 25 May in reply to Ivan Danchev Link to this post

    Hi Ivan,
    I found that we can extend the kendo multiselect and create one that allows duplications, (see: http://jsfiddle.net/abhinavg/ds0qyohu/ )
    I was just wondering if there is any explanation about the implementation (like what is the fn in MultiSelect.fn.init.call ? what does this line do that.currentTag(null); ?

    Regards,
    Entisar
  8. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1117 posts

    Posted 29 May Link to this post

    Hi Entisar,

    The Support Service provides guidance and assistance with the widgets built-in features and API. Source code explanation and guidance on extending the widgets, aiming at achieving custom behavior different from the way the widget works by design, is provided by our Professional Services team. If you are interested in their services let us know and we will put you in touch with them.

    Regards,
    Ivan Danchev
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top