jQWidgets Forums

jQuery UI Widgets Forums General Discussions Lists DropDownList render callback function when using async json data source

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 10 months ago.

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

  • SkippingAdi
    Participant

    Hi all

    I have the following configuration for a jqxDropDownList:

            var ddlSource =
    {
    url: <url>,
    datatype: "json",
    datafields: [
    { name: "AnlassId", type: 'number' },
    { name: "Name", type: 'string' },
    { name: "Schauort", type: 'string' },
    { name: "Datum", type: 'date', format: "yyyy-MM-ddTHH:mm:ss.fff" },
    ]
    };
    var ddlDataAdapter = new $.jqx.dataAdapter(ddlSource);
    ddl.jqxDropDownList(
    {
    source: ddlDataAdapter,
    displayMember: 'Name',
    valueMember: 'AnlassId',
    width: 400,
    height: 25,
    theme: theme,
    renderer: function (index, label, value) {
    //ToDo: How accessing the whole record so that following line works?
    //GetSelectedItem seems not to work.
    var datarecord = ???? // <- How to set this variable?
    return datarecord.Name + "<br /><p>" + datarecord.Datum + "</p>, " + datarecord.Schauort;
    }
    });

    Question ist:
    Can I use the renderer callback when using a async datasource so that I have access to the whole ‘dataItem’ as specified in ddlSource for formatting a multiline item of the dropdown list? When yes, how can I acess the ‘dataItem’?

    Thank you
    Adrian


    Peter Stoev
    Keymaster

    Hi Adrian,

    In the “renderer” callback, you do not have access to the data source and the item. You have access to the label and value loaded in the DropDownList and depending on that, you should decide what HTML or Text to return in the “renderer” callback.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.