Is there any way to notify user that were nothing found by his search query? Something like in JIRA comboboxes. > http://i.stack.imgur.com/rKsGa.png

有帮助吗?

解决方案

There is nothing integrated, but you can easily build this yourself.

See this jsFiddle for a demo.

Basically, what's happening is:

  1. Return from your server. if there wasn't something found, a dummy entry with a special id.
  2. Register the Select-Event on the ComboBox.
  3. In the event, check to see if the selected item has your special id, and if yes, cancel the event with e.preventDefault()

Code:

$('input').kendoComboBox({
    dataTextField: 'text',
    dataValueField: 'id',
    dataSource: {
        transport: {
            read: function(options) {
                //instead, specify ajax call!
                options.success([{ id: -1, text: 'No Matches...' }]);
            }
        }
    },
    placeholder: "Select...",
    select: function(e) {
        var dataItem = this.dataItem(e.item.index());
        if(dataItem.id === -1) {
            e.preventDefault();
        }
    }
});
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top