Unable to select multiple items programatically

3 posts, 0 answers
  1. Claudia
    Claudia avatar
    33 posts
    Member since:
    Jun 2017

    Posted 26 Feb Link to this post

    Hi

    I'm using a multiselect and trying to select 2 values programmatically but only the first is really showing. Here is a piece of code of what i'm doing.

    var multi= $("#pilotProgram").data("kendoMultiSelect");

    multi.value(["1", "2"]);
    multi.trigger("change");

    Thank you

  2. Claudia
    Claudia avatar
    33 posts
    Member since:
    Jun 2017

    Posted 27 Feb in reply to Claudia Link to this post

    Hi

    I also tried the filter part

    $("#pilotProgram").kendoMultiSelect({
           dataSource: [
               { value: "1", text: "Option A", isDeleted: false },
               { value: "2", text: "Option B", isDeleted: false },
               { value: "3", text: "Option C", isDeleted: false },           
               { value: "4", text: "Option D", isDeleted: false },
               { value: "5", text: "Option E", isDeleted: false }
           ],
           dataTextField: "text",
           dataValueField: "value",       
           select: function (e) {
               if (e.dataItem.isDeleted) {
                   e.preventDefault();
               }
           },
           change: function (e) {
               assObserv.dataSource.data()[0].pilotProgram = this.dataItem();
           }
       });
        
       //This part is inside change event of the observable (assObserv)
        var pilotMulti = $("#pilotProgram").data("kendoMultiSelect");
        pilotMulti.dataSource.filter({});
        pilotMulti.value(["1", "2"]);
        pilotMulti.trigger("change");

    Thank you

     

     

  3. Claudia
    Claudia avatar
    33 posts
    Member since:
    Jun 2017

    Posted 27 Feb in reply to Claudia Link to this post

    Found the issue I put dataItem() instead of dataItems(). Now is working fine, thank you and sorry for the confusion
Back to Top