Ejemplo n.º 1
0
        public override void Configure(GridViewSettings settings, HtmlHelper html, ViewContext viewContext)
        {
            var gridData = InitializeChecklistFindingsGridData(html);

            settings.Configure(gridData, html, viewContext);

            var isReadOnly = (bool)(ViewData["ReadOnly"] ?? false);

            settings.CommandButtonInitialize = (o, e) =>
            {
                if ((e.ButtonType == ColumnCommandButtonType.Update) || (e.ButtonType == ColumnCommandButtonType.Cancel))
                {
                    e.Visible = !isReadOnly;
                }
            };

            settings.ClientSideEvents.BeginCallback = "function (s, e) { checklistFindingGridOnBeginCallback (s,e) }";
            //settings.ClientSideEvents.EndCallback = "function (s, e) {  checklistFindingGridOnEndCallback (s,e) }";

            settings.CommandColumn.Visible = false;

            settings.SettingsDetail.ShowDetailRow = true;
            settings.SettingsDetail.AllowOnlyOneMasterRowExpanded = false;

            settings.SetDetailRowTemplateContent(c =>
            {
                var loapFindingId = (Guid)DataBinder.Eval(c.DataItem, gridData.Key);

                var loapChecklistId = Questions.FirstOrDefault().RigOapChecklistId;

                if (!c.Grid.IsEditing && !c.Grid.IsNewRowEditing)
                {
                    html.RenderAction("OpenCapaPartial", new { Controller = "Capa", Area = "IRMA", source = "Findings", sourceId = loapFindingId, sourceUrl = "/cOap/OapProtocol/List/" + loapChecklistId });
                }
            });

            settings.CellEditorInitialize = (s, e) =>
            {
                //e.Editor.ReadOnly = false;
            };
        }
Ejemplo n.º 2
0
        public override void Configure(GridViewSettings settings, HtmlHelper html, ViewContext viewContext)
        {
            settings.CommandColumn.Width = Unit.Percentage(2);

            InitializeGridData(GridData, "CreateMaster", "UpdateMaster", "DeleteMaster");

            //Master Grid Specific configurations
            settings.KeyFieldName = GridData.Key;
            settings.Name         = $"{GridData.Name}";
            settings.SettingsDetail.ShowDetailRow = true;
            settings.SettingsDetail.AllowOnlyOneMasterRowExpanded = false;

            //Generic configurations
            settings.Configure(GridData, html, viewContext);

            settings.SetDetailRowTemplateContent(c =>
            {
                var loapTypeName = (string)DataBinder.Eval(c.DataItem, GridData.DisplayColumnName);

                var loapTypeId = (int)DataBinder.Eval(c.DataItem, GridData.Key);

                if (!c.Grid.IsEditing && !c.Grid.IsNewRowEditing)
                {
                    ChildGridData.ToolBarOptions.SearchName = $"{ChildGridData.ToolBarOptions.SearchName}_{loapTypeId}";

                    //Important to use RenderAction and Not Action todisplay the child grid rows
                    html.RenderAction(ChildGridData.Action, ChildGridData.Controller, new { oapTypeId = loapTypeId, oapTypeName = loapTypeName });
                }
            });

            int    oapTypeInputId   = (int)(ViewData[CurrentTypeId] ?? 0);
            string oapTypeInputName = (string)(ViewData[CurrentTypeName] ?? string.Empty);

            //Select the Current Row when it defined.
            if (oapTypeInputId != 0)
            {
                settings.Columns.Grid.Selection.SelectRowByKey(oapTypeInputId);
            }
        }
Ejemplo n.º 3
0
        public void ConfigureChild(GridViewSettings settings, HtmlHelper html, ViewContext viewContext)
        {
            int    oapChecklistTopicId   = (int)(ViewData[CurrentTopicId] ?? 0);
            string oapChecklistTopicName = (string)(ViewData[CurrentTopicName] ?? string.Empty);

            ChildGridData.ToolBarOptions.SearchName = $"{ChildGridData.ToolBarOptions.SearchName}_{oapChecklistTopicId}";

            InitializeChildGridData(ChildGridData, "CreateChecklistQuestion", "UpdateChecklistQuestion", "DeleteChecklistQuestion", oapChecklistTopicId, oapChecklistTopicName);

            ChildGridData.Name = $"{ChildGridData.Name}_{oapChecklistTopicName}_{oapChecklistTopicId}";
            //very sensitive to characters only use Unserscore.  using anyother charaters other than alphabets could cause grid display issues.
            settings.SettingsDetail.MasterGridName = $"{GridData.Name}"; // GridInformation.MasterGridName;

            settings.Configure(ChildGridData, html, viewContext);

            settings.SettingsDetail.ShowDetailRow = true;
            settings.SettingsDetail.AllowOnlyOneMasterRowExpanded = false;

            settings.SetDetailRowTemplateContent(c =>
            {
                var loapChecklistQuestionName = (string)DataBinder.Eval(c.DataItem, ChildGridData.DisplayColumnName);

                var loapChecklistQuestionId = (int)DataBinder.Eval(c.DataItem, ChildGridData.Key);

                //Calling SubChild Grids in Child Grid
                SubChildRelatedQuestionGridData.ToolBarOptions.SearchName = $"{SubChildRelatedQuestionGridData.ToolBarOptions.SearchName}_{loapChecklistQuestionId}";
                SubChildTagGridData.ToolBarOptions.SearchName             = $"{SubChildTagGridData.ToolBarOptions.SearchName}_{loapChecklistQuestionId}";

                if (!c.Grid.IsEditing && !c.Grid.IsNewRowEditing)
                {
                    //Important to use RenderAction and Not Action todisplay the child grid rows
                    html.RenderAction(SubChildRelatedQuestionGridData.Action, SubChildRelatedQuestionGridData.Controller, new { oapChecklistQuestionId = loapChecklistQuestionId, oapChecklistQuestionName = loapChecklistQuestionName });

                    html.RenderAction(SubChildTagGridData.Action, SubChildTagGridData.Controller, new { oapChecklistQuestionId = loapChecklistQuestionId, oapChecklistQuestionName = loapChecklistQuestionName });
                }
            });
        }
Ejemplo n.º 4
0
        public override void Configure(GridViewSettings settings, HtmlHelper html, ViewContext viewContext)
        {
            InitializeGridData(GridData, "CreateChecklistTopic", "UpdateChecklistTopic", "DeleteChecklistTopic");

            //Generic configurations
            settings.Configure(GridData, html, viewContext);

            settings.SettingsDetail.ShowDetailRow = true;
            settings.SettingsDetail.AllowOnlyOneMasterRowExpanded = false;

            settings.SetDetailRowTemplateContent(c =>
            {
                var loapChecklistTopicName = (string)DataBinder.Eval(c.DataItem, GridData.DisplayColumnName);

                var loapChecklistTopicId = (int)DataBinder.Eval(c.DataItem, GridData.Key);

                ChildGridData.ToolBarOptions.SearchName = $"{ChildGridData.ToolBarOptions.SearchName}_{loapChecklistTopicId}";

                if (!c.Grid.IsEditing && !c.Grid.IsNewRowEditing)
                {
                    //Important to use RenderAction and Not Action todisplay the child grid rows
                    html.RenderAction(ChildGridData.Action, ChildGridData.Controller, new { oapChecklistTopicId = loapChecklistTopicId, oapChecklistTopicName = loapChecklistTopicName });
                }
            });

            //settings.ClientSideEvents.FocusedRowChanged = "OnFindingsFocusedRowChanged";

            int    oapChecklistTopicId   = (int)(ViewData[CurrentTopicId] ?? 0);
            string oapChecklistTopicName = (string)(ViewData[CurrentTopicName] ?? string.Empty);

            //Select the Current Row when it defined.
            if (oapChecklistTopicId != 0)
            {
                settings.Columns.Grid.Selection.SelectRowByKey(oapChecklistTopicId);
            }
        }