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

MVVM for Grid

6 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nikita
Top achievements
Rank 1
Nikita asked on 01 Aug 2013, 12:10 PM
Hello!
I using Grid on page and want to do some editing of cells.
var grid = $("#daily-tasks-detail-grid").kendoGrid({
    dataSource: {
        transport: {
            read: {
                url: '/json/ords',
                dataType: 'json'
            }
        }
    },
    columns: [
              { title: "Worker"},
              { title: "Description" }
     ],
    rowTemplate: kendo.template($("#rowTemplate").html())
}).data('kendoGrid');
I generate row on this template:
<script id="rowTemplate" type="text/x-kendo-tmpl">
    <tr role="row">
        <td role="gridcell"></td>
        <td role="gridcell"></td>
    </tr>
    <tr role="row">
        <td role="gridcell"></td>
        <td role="gridcell"></td>
    </tr>
</script>
How can I make the data-bind?
For example: <td role="gridcell"><input type="text" data-bind="value: value.name" /></td>

6 Answers, 1 is accepted

Sort by
0
Nikita
Top achievements
Rank 1
answered on 02 Aug 2013, 12:23 PM
I have done so:
http://jsbin.com/edives/3
Why does not the date-bind at all tr?
0
Petur Subev
Telerik team
answered on 05 Aug 2013, 12:42 PM
Hello Nikita,

You have only 3 models in your collection and 3 rows should be created. However you have created your template to contain two TR elements which is invalid inside row template.

Consider using one TR and separate table inside (something like this) or consider using the ListView widget instead.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Nikita
Top achievements
Rank 1
answered on 08 Aug 2013, 05:47 AM
I need to use a table like this:
1 post - a few lines. <tr> <td> </ td> <td> </ td> </ tr>
And the ability to edit certain cells.
Can I do it?
0
Petur Subev
Telerik team
answered on 09 Aug 2013, 01:44 PM
Hello Nikita,

Yes you can, here is an example:

http://jsbin.com/utazis/2/edit


Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Nikita
Top achievements
Rank 1
answered on 12 Aug 2013, 05:04 AM
You do not understand me.
I need to have one model had a few rows in the table.
This is not standard, but it should be.
0
Alexander Valchev
Telerik team
answered on 13 Aug 2013, 03:07 PM
Hi Nikita,

Rendering more than one table row per data item is not supported by Kendo Grid. By design a <tr> element is rendered for each data item. As my colleague Petur explained the row template which you are trying to use is not valid. Please reconsider the layout of your application.

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