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

custom checkbox editor in grid popup is not binding.

1 Answer 638 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vishal
Top achievements
Rank 1
Vishal asked on 23 May 2012, 11:43 AM
HI,

I am following http://demos.kendoui.com/web/grid/editing-popup.html example of  yours and in my case i have one checkbox(Notify) and two number type columns(Notification Amount & Performed Every). what i want to do is disabling the two number type columns(Notification Amount & Performed Every) when checkbox type column(Notify) is is unchecked and enabling these when checkbox is checked..

The code is as follows:

 var dataSourceForAssetType = new kendo.data.DataSource({
            transport: {
                read: {
                    url: '@Url.Action("AssetType", "Home")',
                    dataType: "jsonp"
                },
                destroy: {
                    url: '@Url.Action("DeleteAssetType", "Home")',
                    dataType: "jsonp"
                },
                create: {
                    url: '@Url.Action("CreateAssetType", "Home")',
                    dataType: "jsonp"
                },
                update: {
                    url: '@Url.Action("UpdateAssetType", "Home")',
                    dataType: "jsonp"
                },
                parameterMap: function (options, operation) {
                    if (operation !== "read" && options.models) {
                        return { models: kendo.stringify(options.models) };
                    }
                }

            },
            pageSize: 5,
            schema: {
                model: {
                    id: "AssetTypeID",
                    fields: {
                        AssetTypeID: { editable: false },
                        Description: { validation: { required: true} },
                        Notify: { type: "boolean" },
                        NotificationAmount: { type: "number" },
                        PerformedEvery: { type: "number" }
                    }
                }
            }
        });

        $("#grdAssetType").kendoGrid({
            dataSource: dataSourceForAssetType,
            pageable: true,
            resizable: true,
            groupable: true,
            toolbar: ["create"],
            columns: [
                { field: "Description", title: "Description" },
                { field: "Notify", title: "Notify ?" },
                { field: "NotificationAmount", title: "Notification Amount(Days)" },
                { field: "PerformedEvery", title: "Performed Every(Days before due)" },
                { command: ["edit"], title: " ", width: "100px" },
                { command: ["destroy"], title: " ", width: "100px"}],
            editable: "popup"
        });

How can i achieve these.

I Have also applied my custom editor for the checkbox column with custom attribute so to recognize the textbox and change the behaviour with the jquery.attr property like below:

editor: function (container, options) {
                        $('<input type="checkbox" myattr="notifyattr" name="' + options.field + '"/>')
                            .appendTo(container);
                    }
but now i am losing binding for this field.

Can you please help me out with the solution for this?

1 Answer, 1 is accepted

Sort by
0
charan
Top achievements
Rank 1
answered on 26 May 2012, 06:15 AM
hi,
i also used check box in my application.My requirement is, if the value is true then it has to display one image and if the value is false, then it has to display another image.
my code:
{ field: "Active", title: "active", width: "60px", template: '<input type="checkbox" #= Active ? "checked=checked" : "" # disabled="disabled" ></input>' },

if my value is true then where i have to give the image path and how i have to give the image path?
Tags
Grid
Asked by
Vishal
Top achievements
Rank 1
Answers by
charan
Top achievements
Rank 1
Share this question
or