jQWidgets Forums

This topic contains 3 replies, has 2 voices, and was last updated by  Tyl 11 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Event description #47965

    Tyl
    Participant

    Hi,

    Most of the event bindings return an Event object, but I couldn’t find any description of the attributes of the Event.
    The only thing we know is that we can access the item with event.args.item.
    But the item that I get doesn’t contain my original object.

    The declaration
    $("#movie_search").jqxInput({ placeHolder: "Enter a movie title", displayMember: "title"});

    Setting the source

        var movie_list = new Array();
        var movie = {"id_movie": 5, "title": 'Tron'};
        movie_list.push(movie);
        $("#movie_search").jqxInput({source: movie_list});
    

    select event (where I cannot get my item)

    $('#movie_search').on('select', function (event) {
      var item = event.args.item;
      alert("Title = " + item.title); // this gives me "Title = undefined"
    }
    Event description #47967

    Tyl
    Participant

    I would like to add a precison.
    I am aware of the displayMember and valueMember attributes, and they would be sufficient if I only had to get only one attribute from my movie object, but actually the movie object contains more attributes and I have to get them all, that’s why I would like to get the whole movie object in the returned item.

    Event description #47982

    Peter Stoev
    Keymaster

    Hi Tyl,

    The object is not included in the event arguments, just the displayMember and valueMember if specified and they are accessible through the label and value members of the returned item object. When you have the label and value and would like to find the data source object, then you will need to use the dataAdapter’s records array and loop through it to find the matching data source object comparing for example the data source object’s “title” with the item’s label.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Event description #47993

    Tyl
    Participant

    Thanks Peter, that’s the solution I choosed.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.