Actions Menu?
Hi,
I have somehow managed to make my custom module`s backend template look like Sitefinity`s templates.
I want to have menus (at the top), context menus for each item in grid etc. Please tell me how can I have these menus in my template. Are there controls available for or what?
Please see the screenshot to have better idea what I want to achieve.
Thanks
Hi saadi,
You should use definitions. In fact, in Sitefinity, UI is mostly defined through definitions.
Following the encircled areas in your screenshot here is how these defintinitions could look like:
WidgetBarSectionElement masterViewToolbarSection = new WidgetBarSectionElement(productsGridView.ToolbarConfig.Sections) Name = "toolbar" ; var createproductsWidget = new CommandWidgetElement(masterViewToolbarSection.Items) Name = "CreateproductsWidget", ButtonType = CommandButtonType.Create, CommandName = DefinitionsHelper.CreateCommandName, Text = "CreateItem", ResourceClassId = typeof(ProductsResources).Name, CssClass = "sfMainAction", WidgetType = typeof(CommandWidget), PermissionSet = ProductsConstants.Security.PermissionSetName, ActionName = ProductsConstants.Security.Create ; masterViewToolbarSection.Items.Add(createproductsWidget);WidgetBarSectionElement sidebarSection = new WidgetBarSectionElement(productsGridView.SidebarConfig.Sections) Name = "Filter", Title = "FilterProducts", ResourceClassId = typeof(ProductsResources).Name, CssClass = "sfFirst sfWidgetsList sfSeparator sfModules", WrapperTagId = "filterSection" ; sidebarSection.Items.Add(new CommandWidgetElement(sidebarSection.Items) Name = "AllProducts", CommandName = DefinitionsHelper.ShowAllItemsCommandName, ButtonType = CommandButtonType.SimpleLinkButton, Text = "AllProducts", ResourceClassId = typeof(ProductsResources).Name, CssClass = "", WidgetType = typeof(CommandWidget), IsSeparator = false, ButtonCssClass = "sfSel", );var gridMode = new GridViewModeElement(productsGridView.ViewModesConfig) Name = "Grid";productsGridView.ViewModesConfig.Add(gridMode);DataColumnElement titleColumn = new DataColumnElement(gridMode.ColumnsConfig) Name = "Title", HeaderText = Res.Get<Labels>().Title, HeaderCssClass = "sfTitleCol", ItemCssClass = "sfTitleCol", ClientTemplate = @"<a sys:href='javascript:void(0);' sys:class="" 'sf_binderCommand_edit sfItemTitle sf' + UIStatus.toLowerCase()""> <strong>Title</strong> <span class='sfStatusLocation'>Status</span></a>";gridMode.ColumnsConfig.Add(titleColumn);Got idea of how things happens in backend. It seems to be little hectic for defining configurations for each module`s backend control. Can you provide me a starter for it?
What is productsGridView in this sample?
Hi saadi,
The is the MasterGridViewElement. This is the configuration element for the MasterView view. The MasterView shows a list of generic content items
Regards,