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

Using Custom Widget as Custom Editor in a grid

2 Answers 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lance
Top achievements
Rank 1
Lance asked on 31 Jul 2014, 05:31 AM
Hi,

I'm having trouble using my custom widget as a custom editor in a grid. It seems to call the init of my widget 3 times for every line.  Also when I click on a cell with my widget, it disappears.  The widget works correctly outside of the grid and binds fine.  I want my grid to be inline edit with batch edit so it is permanently in edit mode like an Excel spreadsheet.  Please can you help me see what I'm doing wrong.  Thanks.

My grid definition:
    <div
        id="elgrid"
        style="width: 750px; height: 350px"
        data-role="grid"
        data-editable="{mode: 'incell', createAt: 'bottom'}"
        data-bind="source: equipmentDetailSource, events: { edit: gridEdit }"
        data-selectable="cell"
        data-filterable="false"
        data-auto-bind="true"
        data-columns='[ {"field": "EquipmentRequestLineNo", "title": "Line No"}, 
                        {"field": "EquipmentId", "title": "Equipment"}, 
                        {"field": "Quantity", "title": "Quantity"},    
                        {"field": "RecipientName", "title": "Recipient", "template": kendo.template($("#findUsertemplate").html())},              
                        {"field": "Reason", "title": "Reason"}, 
                        {"command": "destroy", "title": " ", "width": "110px"}]'>
    </div>

    <script type="text/x-kendo-template" id="findUsertemplate">
        <div data-role="usersearch" data-bind="value: RecipientBems, events: { change: change }" data-display-bems="false"></div>
    </script>

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 04 Aug 2014, 07:11 AM
HI Lance,

Basically the desired behavior of having all rows of the Grid in edit mode is not supported out of the box and requires custom solution. There are several ways you can do this and which one you would choose depends entirely on you and the exact setup that you have. For example you can use the the "rowTemplate" option to define the row template and disable the editing of the grid - please check the example below:

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lance
Top achievements
Rank 1
answered on 05 Aug 2014, 05:34 AM
Thanks Vladimir,

Using the rowtemplate approached worked.
Tags
General Discussions
Asked by
Lance
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Lance
Top achievements
Rank 1
Share this question
or