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

Column template not appearing for new rows

8 Answers 359 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 15 Dec 2011, 06:06 PM

I'm using a column template to display my StatusTypes array.  It works fine, but when I use the "create" toolbar to add a row, the column template isn't displayed.  Once I hit "save", then it shows, but I would like it to appear right when the user clicks "create".

$("#gridEmailAddress").kendoGrid({
    dataSource: mydatasource,
    scrollable: true,
    sortable: true,
    pageable: true,
    editable: true,
    resizeable: true,
    toolbar: ["create", "save", "cancel"],
    columns: [
            { field: "Address", width: 190, title: "Email Address" },
            { field: "Name", width: 190, title: "Name" },
            { field: "StatusTypes", template: columnTemplate, title: "Status Types:" },
            { command: "destroy", title: " ", width: 120 }
            ]
});

 

8 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 16 Dec 2011, 09:02 AM
Hi Brandon,

I'm afraid that I'm unable to recreate such behavior locally. Please take a look at the following example, maybe I'm missing something obvious.
  


Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Brandon
Top achievements
Rank 1
answered on 16 Dec 2011, 03:52 PM
Rosen,

I think I figured out the issue, thanks!
0
Brandon
Top achievements
Rank 1
answered on 16 Dec 2011, 04:18 PM
Thanks again!
0
Ivan
Top achievements
Rank 1
answered on 17 Dec 2011, 10:56 AM
Hello,

I think that I have similar issue and it is actually very reproducible.
1. Go here http://demos.kendoui.com/web/grid/editing.html 
2. Delete all the entries from the table, sorry it will take a little while.
3. Then click on Add New Record, nothing will happen.

In console you'll see:
  1. Uncaught TypeError: Cannot read property 'ProductID' of undefined
    1. (anonymous function)
    2. n.extend.indexOfkendo.all.min.js:11
    3. o.extend.indexOfkendo.all.min.js:11
    4. h.extend.addRowkendo.all.min.js:11
    5. h.extend._toolbarkendo.all.min.js:11
    6. f.event.dispatchjquery-1.7.1.min.js:3
    7. f.event.add.h.handle.i

In the application that I develop I see a little different stack trace (POSITION is the column name):
Uncaught ReferenceError: POSITION is not defined
anonymous:2
f.e.extend.proxy.gjquery.min.js:2
Grid.Widget.extend._rowsHtmlkendo.grid.js:1859
Grid.Widget.extend.refreshkendo.grid.js:2018
f.e.extend.proxy.gjquery.min.js:2
Observable.Class.extend.triggerkendo.core.js:123
DataSource.Observable.extend._processkendo.data.js:1293
DataSource.Observable.extend.successkendo.data.js:1250
f.e.extend.proxy.gjquery.min.js:2
RemoteTransport.Class.extend.read.options.successkendo.data.js:795
f.Callbacks.njquery.min.js:2
f.Callbacks.o.fireWithjquery.min.js:2
wjquery.min.js:4
f.support.ajax.f.ajaxTransport.send.d

Thanks!
0
James Lamar
Top achievements
Rank 1
answered on 18 Dec 2011, 04:40 PM
Second Ivan. Is this resolved in another thread?
0
Rosen
Telerik team
answered on 19 Dec 2011, 10:50 AM
Hi Ivan,

We are aware of this issue. Please refer to this forum post, where an internal build which should address this issue can be found.

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ivan
Top achievements
Rank 1
answered on 19 Dec 2011, 11:59 AM
Hello Rosen,

I've just tried the build that you linked to, and did solve the issue. Thank you!

Regards,
Ivan.
0
Elan
Top achievements
Rank 1
answered on 10 Mar 2012, 09:12 PM
In Rosen's example, UnitsInStock is a number.

What if the model  looked like this:

var Product = { Name: 'Milk', Costs: {Actual: 1, Retail: 3}};

I get an error when I try to build a template like this:

template: "<b>#=Product.Costs.Actual#</b>"


Is there a better way to do this?
Tags
Grid
Asked by
Brandon
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Brandon
Top achievements
Rank 1
Ivan
Top achievements
Rank 1
James Lamar
Top achievements
Rank 1
Elan
Top achievements
Rank 1
Share this question
or