Note that there are some explanatory texts on larger screens.

plurals
  1. POKendo Angular's Auto complete showing object in results
    text
    copied!<p>I am trying to use kendo angular's auto complete widget using server filtering. After the service call the popup shows [object Object] and the number of these is equal to the results returned from the server. So could you please have a look at my code and point me to the mistake I am doing. </p> <p>Here is my code:</p> <pre><code>var oThis = this; var uiQueryConfig = this.seUIConfigsCacheService.GetItem('OpportunityDashboard'); var dataSource = new kendo.data.DataSource({ serverFiltering: true, serverPaging: true, pageSize: 20, transport: { read: function (options) { oThis.getDataFromServer(options, uiQueryConfig, false, options.data.filter.filters[0].value); } } }); $scope.dataSource = dataSource; </code></pre> <p>Here is the definition of getDataFromServer:</p> <pre><code>getDataFromServer(options: any, uiConfig: Model.UIConfig, recordsCountNeeded: boolean, searchText?: string): void { var searchParam = new Model.SearchParamsCM(); searchParam.PageIndex = options.data.page; searchParam.PageSize = options.data.pageSize; searchParam.SearchText = searchText; var oThis = this; this._seHttpService.GetWithParms('/spa/api/genericrequest', searchParam) .then(function (result) { var datum = oThis.createJSONFromResults(result.data, uiConfig); if (recordsCountNeeded) //grid options.success(datum); else //auto complete options.success(datum.data); }, function (result) { options.error(result); }); } </code></pre> <p>The code is in typescript. </p> <p>This is in template:</p> <pre><code>&lt;input id="name" kendo-auto-complete k-min-length="3" k-data-text-field="name" k-ignore-case="true" k-data-source="dataSource" ng-model="searchText" /&gt; </code></pre> <p>I tried to debug the options.success function and found out that the parameter value there has a lot of other information including the whole object returned from the server instead of the one I am passing it i.e. datum.data.</p> <p>Thanks in anticipation!</p> <p>EDIT: Ok I have sorted it out. actually there were two issues, first that the variable name in k-data-text-field should be in single quotes i.e. k-data-text-field="'name'". Second the variable name is case sensitive so it should have been k-data-text-field="'Name'"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload