Add Form

Reset
// view model
public class ContributorsViewModel
{
    [BsGrid(HasDetails = true)]
    [Display(Name = "Contributors", ResourceType = typeof(Resource))]
    public BsGridModel<ContributorRowModel> Grid { get; set; }

    [BsToolbar(Theme = BsTheme.Black)]
    [Display(Name = "Contributors", ResourceType = typeof(Resource))]
    public BsToolbarModel<ContributorSearchModel, ContributorNewModel, List<ContributorOrderModel>> Toolbar { get; set; }
}

// common model
public class ContributorModel
{
    public ContributorModel()
    {
        RoleList = new BsSelectList<ProjectRole?>();
        RoleList.ItemsFromEnum(typeof(ProjectRole));
    }

    [Display(Name = "Web address", Prompt = "http://mysite.com or http://twitter.com/id")]
    [BsControl(BsControlType.Url)]
    public string Url { get; set; }

    [Required(ErrorMessageResourceName = "RequiredField", ErrorMessageResourceType = typeof(Resource))]
    [Display(Name = "Contributor since")]
    [BsControl(BsControlType.DatePicker)]
    public BsDateTime StartDate { get; set; }

    [Required(ErrorMessageResourceName = "RequiredField", ErrorMessageResourceType = typeof(Resource))]
    [Display(Name = "Location", Prompt = "Choose your country")]
    [BsControl(BsControlType.DropDownList)]
    public BsSelectList<string> CountriesList { get; set; }

    [Required(ErrorMessageResourceName = "RequiredField", ErrorMessageResourceType = typeof(Resource))]
    [Display(Name = "Role", Description = "Your main role in project")]
    [BsControl(BsControlType.RadioButtonList)]
    public BsSelectList<ProjectRole?> RoleList { get; set; }

    [Required(ErrorMessageResourceName = "RequiredField", ErrorMessageResourceType = typeof(Resource))]
    [Display(Name = "Programming languages", Prompt = "Type your favorite programming languages")]
    [BsControl(BsControlType.TagList)]
    public BsSelectList<List<string>> LanguagesList { get; set; }

    [Display(Name = "Contributions")]
    [BsControl(BsControlType.TextArea)]
    public string Contributions { get; set; }
}

// row model
public class ContributorRowModel : BsGridRowModel<ContributorDetailsReadonly>
{
    public int Id { get; set; }

    [BsGridColumn(Width = 2, MediumWidth = 2, IsEditable = true)]
    public string Name { get; set; }

    [BsGridColumn(Width = 3, MediumWidth = 3)]
    public ProjectRole Role { get; set; }

    [BsGridColumn(Width = 3, MediumWidth = 3)]
    public DateTime StartDate { get; set; }

    [BsGridColumn(Width = 3, MediumWidth = 3)]
    public string Contributions { get; set; }

    [BsGridColumn(Width = 1, MediumWidth = 1)]
    public string Action { get; set; }

    [BsGridColumn(Width = 1, Usage = BsGridColumnUsage.Excel)]
    public bool Enabled { get; set; }

    public override object GetUniqueID()
    {
        return this.Id;
    }
}

// details model
public class ContributorDetailsModel : ContributorNewModel
{
    public ContributorDetailsModel()
        : base() {}

    public int Id { get; set; }
    public bool Enabled { get; set; }

    public string Country { get; set; }

    public ProjectRole Role { get; set; }

    public List<string> Languages { get; set; }

    public DateTime ContributorSince { get; set; }
}

// search model
public class ContributorSearchModel : ContributorModel
{
    public ContributorSearchModel()
    {
        IsEnabled = new BsSelectList<YesNoValueTypes?>();
        IsEnabled.ItemsFromEnum(typeof(YesNoValueTypes));
        IsEnabled.SelectedValues = YesNoValueTypes.Both;

        RoleList = new BsSelectList<ProjectRole?>();
        RoleList.ItemsFromEnum(typeof(ProjectRole));
    }

    [Display(Name = "ChooseInterval", ResourceType = typeof(Resource))]
    [BsControl(BsControlType.DatePickerRange)]
    public BsRange<DateTime?> StartDateRange { get; set; }

    [Display(Name = "Name", ResourceType = typeof(Resource))]
    [BsControl(BsControlType.TextBox)]
    public string Name { get; set; }

    [BsControl(BsControlType.RadioButtonList)]
    [Display(Name = "IsEnabled", ResourceType = typeof(Resource))]
    public BsSelectList<YesNoValueTypes?> IsEnabled { get; set; }

    [Display(Name = "Location", Prompt = "PromptLocation", ResourceType = typeof(Resource))]
    [BsControl(BsControlType.DropDownList)]
    public new BsSelectList<string> CountriesList { get; set; }

    [Display(Name = "Role", Description = "Role in current project")]
    [BsControl(BsControlType.RadioButtonList)]
    public new BsSelectList<ProjectRole?> RoleList { get; set; }

    [Display(Name = "Programming in", Prompt = "Type languages")]
    [BsControl(BsControlType.TagList)]
    public new BsSelectList<List<string>> LanguagesList { get; set; }
}

// new model
public class ContributorNewModel : ContributorModel
{
    public ContributorNewModel() : base()
    {
        IsEnabled = new BsSelectList<YesNoValueTypes?>();
        IsEnabled.ItemsFromEnum(typeof(YesNoValueTypes), YesNoValueTypes.Both);
        IsEnabled.SelectedValues = YesNoValueTypes.Yes;

        RoleList = new BsSelectList<ProjectRole?>();
        RoleList.ItemsFromEnum(typeof(ProjectRole));
        RoleList.SelectedValues = ProjectRole.Developer;
    }

    [Required]
    [BsControl(BsControlType.RadioButtonList)]
    [Display(Name = "IsEnabled", ResourceType = typeof(Resource))]
    public BsSelectList<YesNoValueTypes?> IsEnabled { get; set; }

    [Required(ErrorMessageResourceName = "RequiredField", ErrorMessageResourceType = typeof(Resource))]
    [Display(Name = "FirstName", ResourceType = typeof(Resource))]
    [BsControl(BsControlType.TextBox)]
    public string FirstName { get; set; }

    [Required(ErrorMessageResourceName = "RequiredField", ErrorMessageResourceType = typeof(Resource))]
    [Display(Name = "LastName", ResourceType = typeof(Resource))]
    [BsControl(BsControlType.TextBox)]
    public string LastName { get; set; }
}
            
// toolbar builder
@(Html.BsToolbarFor(x => x.Toolbar)
    .DisplayName("Dev Team")
    .Theme(Html.GetTheme())
    .ConfigureActions(ca =>
    {
        ca.Add(BsToolbarActionType.Add)
            .Text(Resource.Add)
            .Tab(x => Html.BsPartialPrefixed(y => y.New, "Toolbar/_New", x));

        ca.Add<BsToolbarQuickSearch>()
          .Placeholder(Resource.Search);
        
        ca.Add(BsToolbarActionType.AdvancedSearch)
          .Tab(x => Html.BsPartialPrefixed(y => y.Search, "Toolbar/_Search", x));
    })
)

// grid builder
@(Html.BsGridFor(m => m.Grid)
    .Theme(Html.GetTheme())
    .GridResetButton()
    .ConfigureBulkActions(bulk =>
    {
        bulk.AddAction(BsBulkActionType.Excel);
        bulk.AddAction().StyleClass("btn-success js-btn-enable_selected").Title("Enable selected").GlyphIcon(Glyphicon.Ok);
        bulk.AddAction().StyleClass("btn-warning js-btn-disable_selected").Title("Disable selected").GlyphIcon(Glyphicon.Remove);
        bulk.AddAction(BsBulkActionType.Delete);

        bulk.AddSelector(BsBulkSelectorType.All);
        bulk.AddSelector().StyleClass("js-actives").Text(@Resource.Enabled);
        bulk.AddSelector().StyleClass("js-inactives").Text(@Resource.Disabled);
        bulk.AddSelector(BsBulkSelectorType.None);

        bulk.ForSelector(BsBulkSelectorType.All).Text(@Resource.All);
        bulk.ForSelector(BsBulkSelectorType.None).Text(@Resource.None);
    })
    .HtmlAttributes(new { @class = "custom_class" })
    .RowHighlighter(row => row.Enabled ? "#59b444" : "#f0ad4e")
    .RowData(row => new Dictionary<string, object> { { "data-objid", row.Id }, { "data-active", row.Enabled } })
    .ConfigureColumns(cols =>
    {
        cols.Add(c => c.Name).Name(Resource.Name)
                            .SetWidth(2)
                            .Sortable();

        cols.Add(c => c.Role).Name("Role")
                            .SetWidth(3)
                            .Sortable()
                            .Text(row => Html.GetRoleIcon(row.Role) + " " + Html.BsEnumDisplayName(row.Role));

        cols.Add(c => c.StartDate).Name("Contributor since")
                            .SetWidth(3)
                            .Sortable()
                            .Text(row => Html.BsGlyphicon(Glyphicon.Calendar) + " " + row.StartDate.ToMonthNameDate());

        cols.Add(c => c.Contributions).Name("Contributions")
                            .SetWidth(4)
                            .Sortable();

        cols.For(c => c.Name).Name(Resource.Name);
    })
    .PagerSettings(new BsPagerSettings { Size = 5 })
)
            
public class ContributorsController : BaseController
{
    #region Properties and Constructor
    private readonly ContributorsRepository _gridRepository;

    public ContributorsController()
    {
        _gridRepository = new ContributorsRepository(Db);
    }
    #endregion

    #region Pages
    public ActionResult Index()
    {
        var gridModel = _gridRepository.ToBsGridViewModel(new BsGridRepositorySettings<ContributorSearchModel>
        {
            Page = 1,
            PageSize = 5
        });

        var model = new ContributorsViewModel
        {
            Grid = gridModel,
            Toolbar = new BsToolbarModel<ContributorSearchModel, ContributorNewModel>
            {
                Search = _gridRepository.GetSearchForm(),
                New = _gridRepository.GetNewForm()
            }
        };

        var options = new Dictionary<string, object>
        {
            {"pagerUrl", Url.Action("Pager")},
            {"detailsUrl", Url.Action("Details")},
            {"getRowUrl", Url.Action("GetRow")},
            {"enableDisableUrl", Url.Action("EnableDisable")},
            {"exportExcelUrl", Url.Action("ExportExcel")},
            {"updateUrl", Url.Action("Update")},
            {"deleteUrl", Url.Action("Delete")},
            {"editComponents", RequireJsHtmlHelpers.ToJsonDictionary<EditComponents>()}
        };

        RequireJsOptions.Add("index", options);

        return View(model);
    }
    #endregion

    #region Ajax
    public BsJsonResult Pager(BsGridRepositorySettings<ContributorSearchModel> model)
    {
        var msg = string.Empty;
        var status = BsResponseStatus.Success;
        var html = string.Empty;
        var count = 0;

        try
        {
            //simulate exception
            if (model.Page == 3)
            {
                throw new Exception("This is how an exception message is displayed in grid header");
            }

            var viewModel = _gridRepository.ToBsGridViewModel<ContributorsViewModel>(x => x.Grid, model, out count);

            html = this.BsRenderPartialView("Grid/_Grid", viewModel);
        }
        catch (Exception ex)
        {
            msg = ex.Message;
            status = BsResponseStatus.ServerError;
        }

        return new BsJsonResult(new
        {
            Count = count,
            Html = html
        }, status, msg);
    }

    public BsJsonResult New(BsToolbarModel<ContributorSearchModel, ContributorNewModel> model)
    {
        var msg = string.Empty;
        var status = BsResponseStatus.Success;
        var row = string.Empty;

        try
        {
            if (ModelState.IsValid)
            {
                var rowModel = _gridRepository.Create(model.New);

                var viewModel = _gridRepository.ToBsGridViewModel<ContributorsViewModel>(x => x.Grid, rowModel);

                row = this.BsRenderPartialView("Grid/_Grid", viewModel);
            }
            else
            {
                return new BsJsonResult(
                    new Dictionary<string, object> { { "Errors", ModelState.GetErrors() } }, 
                    BsResponseStatus.ValidationError);
            }
        }
        catch (Exception ex)
        {
            msg = Resource.ServerError;
            status = BsResponseStatus.ServerError;
        }

        return new BsJsonResult(new
        {
            Row = row
        }, status, msg);
    }

    public BsJsonResult Update(ContributorDetailsModel model, int objId, EditComponents componentId)
    {
        var msg = string.Empty;
        var status = BsResponseStatus.Success;
        var html = string.Empty;

        try
        {
            ClearModelState(ModelState, componentId);

            if (ModelState.IsValid)
            {
                var detailsModel = _gridRepository.Update(model, objId, componentId);

                //simulate exception
                if (objId == 4)
                {
                    throw new Exception("This is how an exception message is displayed inside row details");
                }

                switch (componentId)
                {
                    case EditComponents.Identity:
                        html = this.BsRenderPartialView("Grid/Details/_IdentityReadonly", detailsModel);
                        break;
                    case EditComponents.ProjectRelated:
                        html = this.BsRenderPartialView("Grid/Details/_ProjectRelatedReadonly", detailsModel);
                        break;
                }
            }
        }
        catch (Exception ex)
        {
            msg = "<strong>" + Resource.ServerError + "!</strong> " + ex.Message;
            status = BsResponseStatus.ServerError;
        }

        return new BsJsonResult(new
        {
            Html = html
        }, status, msg);
    }

    public BsJsonResult GetRow(int objId, bool getDetails = false)
    {
        var msg = string.Empty;
        var status = BsResponseStatus.Success;
        var row = string.Empty;
        var details = string.Empty;

        try
        {                
            var rowModel = _gridRepository.ReadRow(objId);

            var viewModel = _gridRepository.ToBsGridViewModel<ContributorsViewModel>(x => x.Grid, rowModel);

            row = this.BsRenderPartialView("Grid/_Grid", viewModel);

            if (getDetails)
            {
                var detailsModel = _gridRepository.ReadDetails(objId);

                details = this.BsRenderPartialView("Grid/Details/_Index", detailsModel);
            }

        }
        catch (Exception ex)
        {
            msg = Resource.ServerError;
            status = BsResponseStatus.ServerError;
        }

        return new BsJsonResult(new
        {
            Row = row,
            Details = details
        }, status, msg);
    }

    public BsJsonResult Details(int objId)
    {
        var msg = string.Empty;
        var status = BsResponseStatus.Success;
        var html = string.Empty;

        try
        {
            //simulate exception
            if (objId == 2)
            {
                throw new Exception("This is how an exception message is displayed inside a BFroms grid row");
            }

            //render row details
            var model = _gridRepository.ReadDetails(objId);
            html = this.BsRenderPartialView("Grid/Details/_Index", model);

        }
        catch (Exception ex)
        {
            msg = "<strong>" + Resource.ServerError + "!</strong> " + ex.Message;
            status = BsResponseStatus.ServerError;
        }

        return new BsJsonResult(new
        {
            Html = html
        }, status, msg);
    }

    public BsJsonResult Delete(List<int> ids)
    {
        var msg = string.Empty;
        var status = BsResponseStatus.Success;

        try
        {
            foreach (var id in ids)
            {
                //simulate exception
                if (id == 3)
                {
                    throw new Exception("This is how an exception message is displayed when it's triggered on row control");
                }

                _gridRepository.Delete(id);
            }
        }
        catch (Exception ex)
        {
            msg = "<strong>" + Resource.ServerError + "!</strong> " + ex.Message;
            status = BsResponseStatus.ServerError;
        }

        return new BsJsonResult(null, status, msg);
    }

    public BsJsonResult EnableDisable(List<int> ids, bool? enable)
    {
        var msg = string.Empty;
        var status = BsResponseStatus.Success;

        try
        {
            foreach (var id in ids)
            {
                //simulate exception
                if (id == 2)
                {
                    throw new Exception("This is how an exception message is displayed when it's triggered on row control");
                }

                _gridRepository.EnableDisable(id, enable);
            }
        }
        catch (Exception ex)
        {
            msg = "<strong>" + Resource.ServerError + "!</strong> " + ex.Message;
            status = BsResponseStatus.ServerError;
        }

        return new BsJsonResult(null, status, msg);
    }

    public ActionResult ExportExcel(BsGridRepositorySettings<ContributorSearchModel> settings, List<int> ids)
    {
        var items = _gridRepository.GetItems(settings, ids);

        try
        {
            var builder = new BsGridExcelBuilder<ContributorRowModel>("BForms Contributors.xlsx", items);

            builder.ConfigureHeader(header =>
                    {
                        header.Style.Font.Bold = true;
                        header.Style.FillColor = BsGridExcelColor.Ivory;
                        header.For(x => x.StartDate)
                                .Text("Contributor since")
                                .Style(style => style.Font.Italic = true);
                    })
                    .ConfigureRows((row, style) =>
                    {
                        if (row.Role == ProjectRole.TeamLeader)
                        {
                            style.Font.Bold = true;
                        }
                        if (row.Role == ProjectRole.Tester)
                        {
                            style.Font.Italic = true;
                        }
                    })
                    .ConfigureColumns(columns =>
                    {
                        columns.For(x => x.Enabled)
                                .Text(x => x.Enabled ? Resource.Yes : Resource.No)
                                .Style((row, style) => style.FillColor = row.Enabled ? BsGridExcelColor.LightGreen : BsGridExcelColor.Red);
                        columns.For(x => x.Role)
                                .Text(x => x.Role.ToString())
                                .Style(style => style.FillColor = BsGridExcelColor.Lavender);
                        columns.For(x => x.StartDate)
                                .Text(x => x.StartDate.ToMonthNameDate())
                                .Style(style => style.Font.Italic = true);
                    });

            return new BsExcelResult<ContributorRowModel>("BForms Contributors.xlsx", builder);
        }
        catch (Exception ex)
        {
            var controllerName = (string)Request.RequestContext.RouteData.Values["controller"];
            var actionName = (string)Request.RequestContext.RouteData.Values["action"];

            return View("Error", new HandleErrorInfo(ex, controllerName, actionName));
        }
    }
    #endregion
}

            
require([
        'jquery',
        'bforms-namespace',
        'bforms-grid',
        'bforms-toolbar',
        'bootstrap',
        'bforms-ajax',
        'main-script'
], function () {

    //#region Constructor and Properties
    var GridIndex = function (options) {
        this.options = $.extend(true, {}, options);
        this.init();
    };

    GridIndex.prototype.init = function () {
        this.$grid = $('#grid');
        this.$toolbar = $('#toolbar');

        this.initGrid();
        this.initToolbar();
    };
    //#endregion

    //#region Grid
    GridIndex.prototype.initGrid = function () {
        this.$grid.bsGrid({
            $toolbar: this.$toolbar,
            uniqueName: 'usersGrid',
            pagerUrl: this.options.pagerUrl,

            //#region filterButtons
            filterButtons: [{
                btnSelector: '.js-actives',
                filter: function ($el) {
                    return $el.data('active') == 'True';
                }
            }, {
                btnSelector: '.js-inactives',
                filter: function ($el) {
                    return $el.data('active') != 'True';
                },
            }],
            //#endregion

            //#region gridActions
            gridActions: [{
                btnSelector: '.js-btn-exportExcel_selected',
                handler: $.proxy(function ($rows, context) {
                    var data = {};
                    var ids = [];
                    $rows.each(function () {
                        ids.push($(this).data('objid'));
                    });
                    data.ids = ids;
                    data.settings = context.refreshModel;

                    this._exportExcel(data, this.options.exportExcelUrl);

                }, this)
            }, {
                btnSelector: '.js-btn-enable_selected',
                handler: $.proxy(function ($rows, context) {
                    var data = {};
                    var ids = [];
                    $rows.each(function () {
                        ids.push($(this).data('objid'));
                    });
                    data.ids = ids;
                    data.enable = true;

                    this._ajaxEnableDisable($rows, data, this.options.enableDisableUrl, function (response) {
                        $rows.each(function () {
                            context.updateRow($(this), $(this).hasClass('open'));
                        });
                    }, function (response) {
                        context._pagerAjaxError(response);
                    });
                }, this)
            }, {
                btnSelector: '.js-btn-disable_selected',
                handler: $.proxy(function ($rows, context) {
                    var data = {};
                    var ids = [];
                    $rows.each(function () {
                        ids.push($(this).data('objid'));
                    });
                    data.ids = ids;
                    data.enable = false;

                    this._ajaxEnableDisable($rows, data, this.options.enableDisableUrl, function (response) {
                        $rows.each(function () {
                            context.updateRow($(this), $(this).hasClass('open'));
                        });
                    }, function (response) {
                        context._pagerAjaxError(response);
                    });
                }, this)
            }, {
                btnSelector: '.js-btn-delete_selected',
                handler: $.proxy(function ($rows, context) {
                    var ids = [];
                    $rows.each(function () {
                        ids.push($(this).data('objid'));
                    });
                    this._ajaxDelete($rows, ids, this.options.deleteUrl, $.proxy(function () {
                        $rows.remove();
                        context._evOnRowCheckChange($rows);
                        if (this.$grid.find('.grid_row[data-objid]').length == 0) {
                            this.$grid.bsGrid('refresh');
                        }
                    }, this), function (response) {
                        context._pagerAjaxError(response);
                    });
                }, this),
                popover: true
            }],
            //#endregion

            updateRowUrl: this.options.getRowUrl,
            detailsUrl: this.options.detailsUrl,
            beforeRowDetailsSuccess: $.proxy(this._beforeDetailsSuccessHandler, this),
            afterRowDetailsSuccess: $.proxy(this._afterDetailsSuccessHandler, this),
            rowActions: [{
                btnSelector: '.js-btn_state',
                url: this.options.enableDisableUrl,
                handler: $.proxy(this._enableDisableHandler, this),
            }, {
                btnSelector: '.js-btn_delete',
                url: this.options.deleteUrl,
                init: $.proxy(this._deleteHandler, this),
                context: this
            }]
        });
    };

    //#region DetailsHandler
    GridIndex.prototype._beforeDetailsSuccessHandler = function (e, data) {

        var $row = data.$row,
            response = data.data;

        var identityOpt = this._editableOptions($row, this.options.editComponents.Identity);
        response.$detailsHtml.find('.js-editableIdentity').bsEditable(identityOpt);

        var projectOpt = this._editableOptions($row, this.options.editComponents.ProjectRelated);
        response.$detailsHtml.find('.js-editableProject').bsEditable(projectOpt);
    };

    GridIndex.prototype._editableOptions = function ($row, componentId) {
        return $.extend(true, {}, {
            url: this.options.updateUrl,
            prefix: 'x' + $row.data('objid') + '.',
            additionalData: {
                objId: $row.data('objid'),
                componentId: componentId
            },
            editSuccessHandler: $.proxy(function (editResponse) {
                this.$grid.bsGrid('updateRow', $row, false, true);
            }, this)
        });
    };

    GridIndex.prototype._afterDetailsSuccessHandler = function (e, data) {
        var $row = data.$row;

        $row.find('.js-editableIdentity').bsEditable('initValidation');
        $row.find('.js-editableProject').bsEditable('initValidation');
    };
    //#endregion

    //#region EnableDisableHandler
    GridIndex.prototype._enableDisableHandler = function (e, options, $row, context) {

        var data = [];
        data.push($row.data('objid'));

        this._ajaxEnableDisable($row, data, options.url, function (response) {
            context.updateRow($row, $row.hasClass('open'));
        }, function (response) {
            context._rowActionAjaxError(response, $row);
        });

    };

    GridIndex.prototype._ajaxEnableDisable = function ($html, data, url, success, error) {
        var ajaxOptions = {
            name: '|enableDisable|' + $html.data('objid'),
            url: url,
            data: data,
            context: this,
            success: success,
            error: error,
            loadingElement: $html,
            loadingClass: 'loading'
        };
        $.bforms.ajax(ajaxOptions);
    };
    //#endregion

    //#region Print
    GridIndex.prototype._exportExcel = function (data, url) {
        window.location.assign(url + "?" + $.bforms.param(data));
    };
    //#endregion

    //#region DeleteHandler
    GridIndex.prototype._deleteHandler = function (options, $row, context) {

        //add popover widget
        var $me = $row.find(options.btnSelector);
        $me.popover({
            html: true,
            placement: 'left',
            content: $('.popover-content').html()
        });

        // add delegates to popover buttons
        var tip = $me.data('bs.popover').tip();
        tip.on('click', '.bs-confirm', $.proxy(function (e) {
            e.preventDefault();

            var data = [];
            data.push($row.data('objid'));

            this._ajaxDelete($row, data, options.url, function () {
                $row.remove();
            }, function (response) {
                context._rowActionAjaxError(response, $row);
            });

            $me.popover('hide');
        }, this));
        tip.on('click', '.bs-cancel', function (e) {
            e.preventDefault();
            $me.popover('hide');
        });
    };

    GridIndex.prototype._ajaxDelete = function ($html, data, url, success, error) {
        var ajaxOptions = {
            name: '|delete|' + data,
            url: url,
            data: data,
            context: this,
            success: success,
            error: error,
            loadingElement: $html,
            loadingClass: 'loading'
        };
        $.bforms.ajax(ajaxOptions);
    };
    //#endregion

    //#endregion

    //#region Toolbar
    GridIndex.prototype.initToolbar = function () {

        // on init
        this.$toolbar.bsToolbar({
            uniqueName: 'usersToolbar',
            subscribers: [this.$grid]
        });

    };
    //#endregion

    //#region Dom Ready
    $(document).ready(function () {
        var ctrl = new GridIndex(window.requireConfig.pageOptions.index);
    });
    //#endregion
});
            
Loading...