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

List view data banding is not working

1 Answer 109 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 09 Apr 2012, 02:25 PM
Hii,

Here is my code for kendo ui listview but the problem is that the list view is not going to bind.


<div id="example" class="k-content">


    <div id="listView"></div>


    <div class="k-pager-wrap">
        <div id="pager"></div>
    </div>


    <script type="text/x-kendo-tmpl" id="template">
        <div class="product">
            
            <h3>${Category_ID}</h3>
            
        </div>
    </script>


    <script>
        $(document).ready(function () {
            var dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "/Admin/AddCategory/GetCategoryList", 
                        dataType: "jsonp"
                    }
                },
                pageSize: 12
            });


            $("#pager").kendoPager({
                dataSource: dataSource
            });


            $("#listView").kendoListView({
                dataSource: dataSource,
                template: kendo.template($("#template").html())
            });
        });
    </script>
</div>


Below is the result with comes out when i execute this url:

[{"Category_ID":1,"CategoryName":"Programming Jobs"},{"Category_ID":2,"CategoryName":"Design Jobs"},{"Category_ID":3,"CategoryName":"Writing Jobs"},{"Category_ID":4,"Cate


I dont know what is the error going on.....

can you please help me 

Thanx

1 Answer, 1 is accepted

Sort by
0
Sim
Top achievements
Rank 1
answered on 03 Jul 2012, 03:12 PM
hi,

i dont know if you have figured this one out already, but i thought it would be helpful to others if i'll share this.
got mine working by changing the ${...} to #=...#

although, i am having a bit of a problem passing a value from datasource to controller.  i.e., i am having a getImage in my controller to render an image byte and that it uses a params.id to pull the right row from the database table.  for now, i have the image rendered as <img src='http://localhost:8080/?????????/addOn/getImage/#=id#' alt="#=name# image"/>.  but still, i kind of hoping that someone could help me change this into a much better way in grails way like using the ${controller: ??, action:??, params: [id.id]} in the img url.

any suggestion/help would be much appreciated.  thank you.
Tags
ListView
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Sim
Top achievements
Rank 1
Share this question
or