This is a migrated thread and some comments may be shown as answers.

ListView is not showing/binding data

3 Answers 212 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Towhidul
Top achievements
Rank 1
Towhidul asked on 13 Mar 2015, 08:08 AM
I have ListView like following:

    <div ng-controller="patientSearchCtrl">
        <div kendo-list-view id="listView" k-data-source="source">
            <div class="product" k-template>
                <h3>{{ dataItem.First_Name }}</h3>
                <p>{{ dataItem.Last_Name }}</p> 
            </div>
        </div>
        <div kendo-pager k-data-source="source"></div>
    </div>


And following AngularJS code:

    angular.module("alertApp", ["kendo.directives"])
            .controller("patientSearchCtrl", function ($scope, $http) {
                var product;
                $http.get('http://localhost:1242/Api/PatientSearch?firstName=Bar&lastName=wells&pageIndex=0&pageSize=10&sortingOrder=FIRST_NAME').
                  success(function (info, status, headers, config) {                     
                      product = info[0]["Table"];
                      console.log(product); 
                  }).
                  error(function (data, status, headers, config) {
                      console.log('Error: ' + data);
                  });
                $scope.source = new kendo.data.DataSource({
                    data: product,
                    pageSize: 1
                });
            });                                                                                                  
   

  console.log(product); is logging data. In Chrome it looks like:
    [Object]
          0: Object
                  DOB: "07-29-1969"
                  First_Name: "Barbara"
                  Last_Name: "Wells"
                  PatientKey: 3
                  RowIndex: 1
                  
I'm using telerik.kendoui.professional.2014.3.1411.trial version.













3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 17 Mar 2015, 08:23 AM
Hello,

please check this example for the correct means to integrate $http service with a datasource instance.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Towhidul
Top achievements
Rank 1
answered on 17 Mar 2015, 10:19 AM
This is an example of gridview. My problem is with ListView. I've changed my code like following and it still not working.
In example they used

    $scope.gridOptions = {
    ....
    }

What will I use in place of 'gridOptions'?
0
Petyo
Telerik team
answered on 19 Mar 2015, 08:38 AM
Hello Towhidul,

the datasource configuration of the two widgets is the same, since they both use the DataSource component for data binding. 

The variable name does not matter, as long as it matches the attribute value in the directive. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ListView
Asked by
Towhidul
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Towhidul
Top achievements
Rank 1
Share this question
or