0
votes

I'm using codeingniter, doctrine and KendoUI on a project and I've come across this problem: in my DB I have 2 columns of a DB but I want to show them in only one column in the KendoUI grid, so far I've been able to show them, but when I try to create a new row or edit an existing one I can't because the in the template I created I don't know how to specify the fields so I can edit and create rows, I pasted a chunk of the code and if you see in the 4th column is the problem that I have. Thanks in advance.


    schema: {
                    model: {
                        id: "idAction",
                        fields: {
                            actionId: { editable: false }, 
                            strategy: {field:"strategy", type:"number"},
                            actionName: { validation: { required: true } },
                            actionDescription: { validation: { required: true }, type:"string" },
                            actionEstimatedTimeQuantity: {validation: {required:true}, type:"number"},
                            actionEstimatedTimeUnit: {validation:{required:true}},
                            actionEstimatedCost:{validation:{required:true},type:"number"},
                            actionCreatedBy: { editable:false },
                            actionCreatedDate: { editable:false, type:"date" }
                        }
                    }
                }

And in my columns I have


    columns: [ 
                    {
                        field: "strategy",
                        width: "180px",
                        title: "Estrategia a usar",
                        values: strategies 
                    },
                    {
                        field: "actionName",
                        width: "100px",
                        title: "Accion"
                    },
                    {
                        field: "actionDescription",
                        width: "200px",
                        title: "DescripciĆ³n"
                    },
                    {
                        field: "actionEstimatedTimeQuantity - actionEstimatedTimeUnit"
                        template: "#= actionEstimatedTimeQuantity # - #= actionEstimatedTimeUnit #",
                        width: "150px",
                        title: "Tiempo Estimado"
                    },
                    {
                        field: "actionEstimatedCost",
                        width: "150px",
                        title: "Costo Estimado"
                    },
                    {
                        field: "actionCreatedBy",
                        width: "100px",
                        title: "Creada Por"
                    },
                    {
                        field: "actionCreatedDate",
                        width: "150px",
                        title: "Fecha de CreaciĆ³n",
                        format: "{0:MM/dd/yyyy}"
                    },

2

2 Answers

0
votes

Try making a new object 'model' that represents your target data. Populate it and parse it in a controller using whatever logic you specify. Map this new model to your grid.

My team does this for every data element, essentially turning them into business objects, even if it is a direct 1 to 1 relationship.

0
votes

I think you want to display two Numeric columns as a string combination "TimeQuantitiy - TimeUnit". In this case, better you add one more field of type string to the datasource of your kendo grid.

from Server: send one more column of type string "a-b" at client: display it in grid.

Editing: You have two choices -

  1. Use one textbox which accepts input string as "a-b"
  2. Use two textboxes seperated with "-" (you might need to define a custom editor for you column in this case"

I would like to apologize for being more theoretical, I would try to upload some programming if possible.