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

is this a legal cell template: fields stacked on top of each other in the same cell?

1 Answer 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim R
Top achievements
Rank 1
Tim R asked on 01 Feb 2013, 10:36 AM
I am looking for a way to structure textual content within a cell (e.g. <li> bullets or <p> or <div> or <br>).  

This would be one cell:
Monday Menu
Breakfast: eggs&bacon
Lunch: bean&bacon soup
Dinner:bacon-barded duck


The following is just one idea. Maybe there is a better way:

Assuming the fields:

          MondayBreakfast,MondayLunch,MondayDinner, TuesdayBreakfast, TuesdayLunch, TuesdayDinner ... etcetera

is this a legal cell template?

                               
                    <td>   <div>${MondayBreakfast}</div><div>${MondayLunch}</div><div>${MondayDinner}</div>     </td>                       
                   <td>   <div>${TuesdayBreakfast}</div><div>${TuesdayLunch}</div><div>${TuesdayDinner}</div>  </td>  

If yes, how would the columns attributes (title literal, sortable, groupable, etc) be defined in the grid configuration?
.
,schema: {
                model: {
                    fields: {
                        MondayBreakfast: { type: "string" },
                        MondayLunch: { type: "string" },
                        MondayDinner: { type: "string" },
                       TuesdayBreakfast: { type: "string" },
                       TuesdayLunch: { type: "string" },
                        TuesdayDinner: { type: "string" },
                       WednesdayBreakfast: { type: "string" },
                       WednesdayLunch: { type: "string" }
                         etc etc
                    }
                }
            }
        },
 columns: [
    { field: ??  , groupable: false, sortable: false, title: "Monday Menu", width: 150 },
    { field: ?? , groupable: false, sortable: false, title: "Tuesday Menu", width: 150 },
   
]
.
.
.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 05 Feb 2013, 09:18 AM
Hi Tim,

Indeed, you can set similar column template as the one in question.

Regarding the column field. It can only be a single field, not a array of fields. If a template is set, this field will be used when grid is grouped, sorted, filtered or edited by the particular column. Thus, if in your scenario, such operations on this column are not required, you may omit the column field declaration.

Greetings,
Rosen
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
Tim R
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or