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

Popup edit save crashes

1 Answer 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 08 May 2012, 05:43 PM
I have a grid with a popup edit window. The edit window comes up without problem. When I edit I get the popup window with the appropriate fields. When I click update after editing the description the javascript fails with the following code highlighted:

return isFinite(b.valueOf())?b.getUTCFullYear()+"-"+pad(b.getUTCMonth()+1)+"-"+pad(b.getUTCDate())+"T"+pad(b.getUTCHours())+":"+pad(b.getUTCMinutes())+":"+pad(b.getUTCSeconds())+"Z":null}

Anyone have any thoughts on why this is happening?

Page code is as follows:

@model HopitelNetworksPlatform.Models.FacilityProblem
 
@{
    ViewBag.Title = "ProblemTracking";
}
 
 
<h2>Problem Tracking<br />
Facility: @Model.FacilityName
</h2>
 
<p>
    @Html.ActionLink("Add Problem", "CreateProblem", new { facilityID = Model.FacilityID } )
</p>
 
<div id="test"></div>
<div id="problemGrid"></div>
 
<script type="text/javascript">
 
    var gridLoaded = false;
 
    var categoryData = new kendo.data.DataSource({
         
        schema: {
            model: {
                id: "ProblemCategoryID",
                fields: {
                    ProblemCategoryID: { type: "int" },
                    ProblemCategoryName: { type: "string" }
                }
            }
        },
        transport: {
            read: {
                url: "@Url.Action("ProblemCategoryList", "Diagnostic")",
                type: "POST"
            }
        }
    });
    categoryData.read();
 
    var bedData = new kendo.data.DataSource({
         
        schema: {
            model: {
                id: "RoomBedID",
                fields: {
                    RoomBedID: { type: "int" },
                    RoomBedName: { type: "string" }
                }
            }
        },
        transport: {
            read: {
                url: "@Url.Action("RoomBedList", "Facility", new { facilityID = Model.FacilityID })",
                type: "POST"
            }
        },
        change: function(e) {
            if(gridLoaded == false) {
                DisplayGrid();
                gridLoaded = true;
            }
        }
    });
    bedData.read();
 
    function lookupCategoryName(ProblemCategoryID)
    {
        if(ProblemCategoryID == undefined) {
            return "";
        }
        else {
            var problemCategory = categoryData.get(ProblemCategoryID);
            return problemCategory.ProblemCategoryName;
        }
    }
      
    function lookupBedName(RoomBedID)
    {
        if(bedData.total() == 0)
        {
            return RoomBedID.toString();    //(todo)(change to unknown or something)
        }
        else
        {
            if(RoomBedID == undefined) {
                return "";
            }
            else {
                var roomBed = bedData.get(RoomBedID);
                return roomBed.RoomBedName;
            }
        }
    }
    
 
function DisplayGrid() {
 
    $("#problemGrid").kendoGrid({
        pageable: true,
        columns: [
            { field: "RoomBedID", title: "Location", width: "5%",
                editor: function(container,options) {
                    $('<input name="' + options.field + '"/>').appendTo(container).kendoDropDownList({
                        dataSource: bedData,
                        dataValueField: "RoomBedID",
                        dataTextField: "RoomBedName",
                        autobind: false
                     });
                 },
                 template: "#= lookupBedName(RoomBedID) #"              
            },
            { field: "DateReported", title: "Date Reported"  },
            { field: "ProblemCategoryID", title: "Problem Type",
                editor: function(container,options) {
                    $('<input name="' + options.field + '"/>').appendTo(container).kendoDropDownList({
                        dataSource: categoryData,
                        dataValueField: "ProblemCategoryID",
                        dataTextField: "ProblemCategoryName",
                        autobind: false
                     });
                 },
                 template: "#= lookupCategoryName(ProblemCategoryID)  #"
            },
            { field: "ProblemDescription", title: "Problem Description" , width: "30%" },
            { field: "DateResolved", title: "Date Resolved" },
            { field: "ResolutionDescription", title: "Resolution", width: "30%" },
            { command: "edit", title: "Edit", width: "110px" }
        ],
        editable: "popup",
        toolbar: ["create", "save", "cancel"],
        dataSource: {
            schema: {
                model: {
                    id: "ProblemID",
                    fields: {
                            ProblemID: { type: "int", editable: false, nullable: true },
                            RoomBedID: { type: "int", nullable: true },
                            RoomBedName: { type: "string" },
                            DateReported: { type: "date", editable: false },
                            ProblemCategoryID: { type: "int", nullable: true },
                            ProblemCategory: { type: "string" },
                            ProblemDescription: { type: "string" },
                            DateResolved: { type: "date", nullable: true, editable: false },
                            ResolutionDescription: { type: "string", nullable: true }
                    }
                }
            },
            batch: true,
            pageSize: 10,
            transport: {
                create: {
                    url: "@Url.Action("CreateProblem2", "Diagnostic")",
                    type: "POST"
                },
                read: {
                    url: "@Url.Action("ProblemList", "Diagnostic", new { facilityID = Model.FacilityID })",
                    type: "POST"
                },
                update: {
                    url:"@Url.Action("UpdateProblem", "Diagnostic")",
                    type: "POST"
                },
                destroy: {
                    url: "@Url.Action("DestroyProblem", "Diagnostic")",
                    type: "POST"
                }
            }
        }
    });
}
 
 
</script>


1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 11 May 2012, 03:46 PM
Hi Richard,

We are not aware of such problem and I was not able to reproduce it locally.
Could you please send me a small but runnable project that reproduces the described behaviour? Please provide such example and we will check it right away.

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