text: (function(){"use strict";BX.namespace("BX.Grid");BX.Grid.UserOptions=function(t,i,e,s){this.options=null;this.actions=null;this.parent=null;this.url=null;this.init(t,i,e,s)};BX.Grid.UserOptions.prototype={init:function(parent,userOptions,userOptionsActions,url){this.url=url;this.parent=parent;try{this.options=eval(userOptions)}catch(err){console.warn("BX.Grid.UserOptions.init: Failed parse user options json string")}try{this.actions=eval(userOptionsActions)}catch(err){console.warn("BX.Grid.UserOptions.init: Failed parse user options actions json string")}},getCurrentViewName:function(){var t=this.getOptions();return"current_view"in t?t.current_view:null},getViewsList:function(){var t=this.getOptions();return"views"in t?t.views:{}},getCurrentOptions:function(){var t=this.getCurrentViewName();var i=this.getViewsList();var e=null;if(t in i){e=i[t]}if(!BX.type.isPlainObject(e)){e={}}return e},getUrl:function(t){return BX.util.add_url_param(this.url,{GRID_ID:this.parent.getContainerId(),bxajaxid:this.parent.getAjaxId(),action:t})},getOptions:function(){return this.options||{}},getActions:function(){return this.actions},getAction:function(t){var i=null;try{i=this.getActions()[t]}catch(e){i=null}return i},update:function(t){this.options=t},setColumns:function(t,i){var e=this.getCurrentOptions();if(BX.type.isPlainObject(e)){e.columns=t.join(",");this.save(this.getAction("GRID_SET_COLUMNS"),{columns:e.columns},i)}return this},setColumnsNames:function(t,i){var e={view_id:"default"};if(BX.type.isPlainObject(e)){e.custom_names=t;this.save(this.getAction("SET_CUSTOM_NAMES"),e,i)}return this},setColumnSizes:function(t,i){this.save(this.getAction("GRID_SET_COLUMN_SIZES"),{sizes:t,expand:i})},reset:function(t,i){var e={};if(!!t){e={view_id:"default",set_default_settings:"Y",delete_user_settings:"Y",view_settings:this.getCurrentOptions()}}this.save(this.getAction("GRID_RESET"),e,i)},setSort:function(t,i,e){if(t&&i){this.save(this.getAction("GRID_SET_SORT"),{by:t,order:i},e)}return this},setPageSize:function(t,i){if(BX.type.isNumber(parseInt(t))){this.save(this.getAction("GRID_SET_PAGE_SIZE"),{pageSize:t},i)}},setExpandedRows:function(t,i){BX.type.isArray(t)&&this.save(this.getAction("GRID_SET_EXPANDED_ROWS"),{ids:t},i)},setCollapsedGroups:function(t,i){BX.type.isArray(t)&&this.save(this.getAction("GRID_SET_COLLAPSED_GROUPS"),{ids:t},i)},resetExpandedRows:function(){this.save(this.getAction("GRID_RESET_EXPANDED_ROWS"),{})},saveForAll:function(t){this.save(this.getAction("GRID_SAVE_SETTINGS"),{view_id:"default",set_default_settings:"Y",delete_user_settings:"Y",view_settings:this.getCurrentOptions()},t)},batch:function(t,i){this.save(this.getAction("GRID_SAVE_BATH"),{bath:t},i)},save:function(t,i,e){var s=this;BX.ajax.post(this.getUrl(t),i,function(t){try{t=JSON.parse(t);if(!t.error){s.update(t);if(BX.type.isFunction(e)){e(t)}BX.onCustomEvent(s.parent.getContainer(),"Grid::optionsChanged",[s.parent])}}catch(i){}})}}})();
  //# sourceMappingURL=useroptions.map.js