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

Help with a tittle popup "edit"

3 Answers 490 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Millcom
Top achievements
Rank 1
Millcom asked on 24 Aug 2012, 03:15 PM
i am working with the web "grid popup editing" and i need to change de tittle of the 
poopup... i need some help... how can i modidy the tittle/label of the popup "edit"?
thanks.



3 Answers, 1 is accepted

Sort by
0
Millcom
Top achievements
Rank 1
answered on 24 Aug 2012, 04:04 PM
i got the solution

<div id="grid"></div>
            <script>
                $(document).ready(function () {
                    isEditing = false;
                    isCreating = false;
    var crudServiceBaseUrl = "http://demos.kendoui.com/service",
                        dataSource = new kendo.data.DataSource({
                            transport: {
                                read:  {
                                    url: crudServiceBaseUrl + "/Products",
                                    dataType: "jsonp"
                                },
                                update: {
                                    url: crudServiceBaseUrl + "/Products/Update",
                                    dataType: "jsonp"
                                },
                                destroy: {
                                    url: crudServiceBaseUrl + "/Products/Destroy",
                                    dataType: "jsonp"
                                },
                                create: {
                                    url: crudServiceBaseUrl + "/Products/Create",
                                    dataType: "jsonp"
                                },
                                parameterMap: function(options, operation) {
                                    if (operation !== "read" && options.models) {
                                        return {models: kendo.stringify(options.models)};
                                    }
                                }
                            },
                            batch: true,
                            pageSize: 30,
                            schema: {
                                model: {
                                    id: "ProductID",
                                    fields: {
                                        ProductID: { editable: false, nullable: true },
                                        ProductName: { validation: { required: true } },
                                        UnitPrice: { type: "number", validation: { required: true, min: 1} },
                                        Discontinued: { type: "boolean" },
                                        UnitsInStock: { type: "number", validation: { min: 0, required: true } },
                                    },
                                }
                            }
                        });
             $("#grid").kendoGrid({
                        dataSource: dataSource,
                        pageable: true,
                        height: 400,
                        toolbar: [{name:"create",text:"Agregar Producto"}],
                        columns: [
                            { field:"ProductName", title: "Product Name" },
                            { field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "150px" },
                            { field: "UnitsInStock", title:"Units In Stock", width: "150px" },
                            { field: "Discontinued", width: "100px" },
                            { command: [{name:"edit",text:"Editar"}, {name:"destroy",text:"Eliminar"}], title: "&nbsp;", width: "210px" }],
                        editable: {mode:"popup"},
                        edit:function(e){
                            if(isEditing){
                                e.container.kendoWindow("title","Modify");
                            }else if(isCreating){
                                e.container.kendoWindow("title","Create");
                            }
                        }
                    });

                    $(".k-grid-edit").on("click",function(){
                                isEditing = true;
                    });
                    $(".k-grid-add").on("click",function(){
                                console.log("xad");
                                isCreating = true;
                    });
                });
0
Joseph
Top achievements
Rank 1
answered on 20 Apr 2017, 06:52 PM

If the record you are creating/editing has an Id you can do this in the edit function:

if (!e.model.Id) {
    e.container.kendoWindow("title", "Create");
} else {
    e.container.kendoWindow("title", "Modify");
}
0
Joseph
Top achievements
Rank 1
answered on 20 Apr 2017, 07:33 PM

Or better you can do this:

if (e.model.isNew()){
 
} else {
 
}
Tags
Grid
Asked by
Millcom
Top achievements
Rank 1
Answers by
Millcom
Top achievements
Rank 1
Joseph
Top achievements
Rank 1
Share this question
or