What object type are selected items?

4 posts, 0 answers
  1. Jason
    Jason avatar
    20 posts
    Member since:
    Aug 2016

    Posted 23 May Link to this post

    I used the MVC example which works perfect as-is I rewrote to work with a JSON request and it ALSO works fine, however when I try to view the data in a string it is trying to display the OBJECT and not the data inside the object. I ASSUMED that the SelectedData is also in JSON format becuase the MultiSelect datasourse is a JSON object.  


             .Placeholder("Select Which Grids to Print...") 
             .DataSource(source =>
                             source.Read(read =>
                                 read.Action("GetCascadeGrid100", "GridPrint")



    So my issue is when I create click button function and I want to display the selected items..  here is what I have tried and the results.  I just want to display my data in a string   Mapname:1 PageNumber:234, Mapname:3, PageNumber:3244 etc...  


    $(document).ready(function () {
                var Gridselect = $("#GridSelect").data("kendoMultiSelect");
                $("#get").click(function () {
                  alert( Gridselect.value + ",  "  + Gridselect.text + ",");
      // this displays nothing but the commas
    // Also have tried
                   var output = '';
                    for (var entry in Gridselect) {
                        output += 'key: ' + entry + ' | value: ' + Gridselect[entry] + '\n';
    // This displays a bunch of data but none of my values, it seems to parse the PageNumber and the MapName so there is something in there.
    // Also Tried 


  2. Jason
    Jason avatar
    20 posts
    Member since:
    Aug 2016

    Posted 23 May in reply to Jason Link to this post

    I noticed a stupid syntax error on the DataValueField it should have been PageNumber, so I am getting the Gridselect.value to display, however if I try to call the Gridselect.text I get an error saying text is not a function. 
  3. Jason
    Jason avatar
    20 posts
    Member since:
    Aug 2016

    Posted 23 May Link to this post

    I'm getting closer..  this gets me all the VALUES but only One of the Text Items

    alert("value: " + Gridselect.value() + "\n" + "text: " + Gridselect.dataItem().MapName); 


    So my results looks something like this:


    text: Map1


    I should have Map1, Map2, Map3, Map4, Map5

  4. Konstantin Dikov
    Konstantin Dikov avatar
    2135 posts

    Posted 25 May Link to this post

    Hello Jason,

    As documented in the following help topic, the dataItems method will return a collection with the selected data items, so you need to traverse all items in that collection for retrieving the MapName values:
    Hope this helps.

    Konstantin Dikov
    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.
Back to Top