Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #111282
    Ondřej
    Participant

    I need to use a DropDownList in React with this functionality.

    By default, it will display the top 30 items loaded on the first page load. Then, I need to filter the rest with an Ajax call.

    The problem is that when the dataSource is set to a callback, it always displays an empty DropDownList.

    Example:

    const topDiagnosis = [

    {
    value: 1,
    label: ‘test a’
    },
    {
    value: 2,
    label: ‘test b’
    },

    ];

    const dataSourceCallback = function(query, response) {
        console.log('dataSourceCallback', query, response)
        return topDiagnosis;
    };
    <DropDownList
          filterable
          filterInputPlaceholder="Hledat"
          dataSource={dataSourceCallback}
    />

    Thank you

    • This topic was modified 4 months ago by Ondřej.
    • This topic was modified 4 months ago by Ondřej.
    • This topic was modified 4 months ago by Ondřej.
    • This topic was modified 4 months ago by Ondřej.
    #111287
    Ondřej
    Participant

    I also tried to use

    const dataSourceCallback = function(query, response) {
        console.log('dataSourceCallback', query, response)
        response(topDiagnosis);
    };
    #111288
    Ondřej
    Participant

    Evem when I use, it show “No items”
    <div>

    <DropDownList
          dataSource={(query, callback) => {
              callback(['aaa', 'bbb'])
          }}
    />
    
    

    </div>

    #111292
    Markov
    Keymaster
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.