jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Binding to JSON demo – id Property for source Object

This topic contains 5 replies, has 2 voices, and was last updated by  mtbvfr 11 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • mtbvfr
    Member

    Hi Peter et al,

    In the Binding to JSON demo (bindingtojson.htm), for the ComboBox widget, an “id” Property is specified for the data source Object but there is no Name/Value pair with a Name of “id” in the customers.txt file.

    Is there a reason that the “id” Property has been specified for the “source” Object or was this line of code copied in from another example and should have been removed?

    Thank you, Michael.


    Peter Stoev
    Keymaster

    Hi,

    You can learn why “id” is used from this help topic: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdataadapter/jquery-data-adapter.htm

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    mtbvfr
    Member

    Hi Peter,

    I had already read that page and it did not answer my question.

    Please read my first post again.

    Thank you, Michael.


    mtbvfr
    Member

    Hello again Peter,

    Whether or not the “id” Setting is included as a Property for the “source” Object, the Resulting Dataset Object has a Name/Value pair with a Name of “uid”.

    When the “id” Setting is included and the Original Dataset has a matching Data Field, then, the data of the Original Dataset is used to populate the Value for the Name/Value pair with a Name of “uid” in the Resulting Dataset.

    When the “id” Setting is included and the Original Dataset does NOT have a matching Data Field, then, the Value for the Name/Value pair with a Name of “uid”, in the Resulting Dataset, is populated incrementally starting with 0 in the order that the Original Dataset is read.

    When the “id” Setting is NOT included, then, the Value for the Name/Value pair with a Name of “uid”, in the Resulting Dataset, is populated incrementally starting with 0 in the order that the Original Dataset is read.

    Now, I would have expected that if the resulting dataset Object was to be searched based on the data of the ID field of the Original Dataset, then, you would have thought that the Original Name (e.g. “id” as in the beverages.txt file) would be used for the Key parameter.

    So, for what reason has an “id” Property been specified in some of the demos when the Original Dataset does not have a matching Data Field?

    Also, whether or not the “id” Property has been specified and whether or not there is a matching Data Field in the Original Dataset, why does the Resulting Dataset use the Name of “uid”?

    Thank you, Michael.


    mtbvfr
    Member

    Bump


    mtbvfr
    Member

    Hi Peter et al,

    I would appreciate a detailed answer to the above post please.

    Thank you, Michael

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

You must be logged in to reply to this topic.