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

Grid with template column not allowing dataSource.read()

2 Answers 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 15 Apr 2016, 06:07 PM

I have the following set up:

    var documentListDataSource = new kendo.data.DataSource({
        transport: {
            read: function (options) {
                debugger;
                var fnum = editData != null ? editData.Number : '';
                var vrid = editData != null ? editData.FormVersionId : 0;
                $.ajax({
                    url: '@Url.Action("GetFormDocumentList", "Form")',
                    dataType: "json",
                    async: false,
                    type: "POST",
                    data: { formNumber: fnum, formVersionId: vrid },
                    success: function (data) {
                        options.success(data);
                    }
                });
            }
        }
    });

 

    function initDocumentGrid() {
        $("#DocumentGrid").kendoGrid({
            dataSource: documentListDataSource,
            navigatable: true,
            selectable: "row",
            columns: [{
                field: "Format",
                title: "Format",
                width: 150
            }, {
                field: "Name",
                title: "File Name",
                width: 150
            }, {
                title: "Actions",
                template: function (dataItem) {
                    return BuildDocumentActionButtons(dataItem);
                }
            }]

        });
    }

    function BuildDocumentActionButtons(dataItem) {
        var retval = '';


        if (dataItem.Extension == "xpd") {
            // interactive mapping button
            //retval += "<button class='k-button k-button-icontext' onclick='OpenMappingWindow();'>Conversion Map</button>"
        }
        if (retval.length > 0) retval += ' &nbsp; ';
        // upload document button - always rendered
        retval += "<button class='k-button k-button-icontext' onclick='OpenUploadWindow(" + datItem.Extension + ");'>Upload</button>"
        //if (dataItem.Name != "") {
        //    retval += ' &nbsp; ';
        //    // toggle availability button
        //    retval += "<button class='k-button k-button-icontext' onclick='ToggleAvailability(" + datItem.Name + ");'>Availability</button>"
        //    retval += ' &nbsp; ';
        //    // remove document button
        //    retval += "<button class='k-button k-button-icontext' onclick='RemoveDocument(" + datItem.Name + ");'>Remove</button>"
        //}
        return retval;
    }


When retval returns button definitions, the following call fails with no error:

$("#DocumentGrid").data("kendoGrid").dataSource.read();

 

I am doing something wrong, but am missing it.

 

Any assistance would be most appreciated.

 

2 Answers, 1 is accepted

Sort by
0
Lee
Top achievements
Rank 1
answered on 19 Apr 2016, 02:18 PM
Never mind.  Invalid javascript will fail with no error thrown.  Semicolons and proper spelling are fundamental.  ><
0
Dimiter Madjarov
Telerik team
answered on 19 Apr 2016, 02:24 PM

Hello Lee,

Thanks for the update. I am glad the issue is resolved.

Regards,
Dimiter Madjarov
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
Lee
Top achievements
Rank 1
Answers by
Lee
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or