Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
Change date input format for cell depending on other cell in grid
posted

Hello!

I have search but not found a working solution for what I want to do, so here is my questions:

In my grid, I have two columns; Status and UpdatedDate, where changing value in the first one should change the input type for the second one.

UpdatedDate use igDateEditor with input format "datetime" as default.

Status use an igCombo for selecting different statuses, saving the selected value as string. Depending on status, I want to change the UpdateDate input format to only "time" or only "date" for each affected row.

Depending on status, I also want to set input for one or more cells on the affected row to required.

The input format for UpdatedDate should be set both when rendering the grid and when changing the status while editing a row.

Ex.

If status is changed to "Done today", the user should only need to set the time for the current day in the UpdatedDate cell. If the status is changed to "Postponed", the user should only need to set the new date, without any time.

I am using the MVC helper to define the grid and want to use rowedit mode.

Here is the updating part of my grid code:

            .Features(feature =>
            {
                feature.Updating()
                .EnableDeleteRow(false)
                .EnableAddRow(false)
                .EditMode(GridEditMode.Row)
                .ColumnSettings(cs =>
                {
                    cs.ColumnSetting().ColumnKey("Status").Required(true).EditorType(ColumnEditorType.Combo).ComboEditorOptions(co => co.DataSource(statuses).Mode(ComboMode.DropDown).EnableClearButton(false));
                    cs.ColumnSetting().ColumnKey("UpdatedDate").EditorType(ColumnEditorType.Date).Required(false).DateEditorOptions(o =>
                    {
                        o.DateInputFormat("dateTime");
                        o.Regional("sv");
                    });
                })
                .RowEditDialogOptions(eo =>
                {
                    eo.ShowReadonlyEditors(true);
                });
                feature.Sorting().Type(OpType.Local);
                feature.Filtering().Type(OpType.Local)
            })

Parents
No Data
Reply Children
No Data