public static void InitializeListConfig(this ComboBoxBase comboBox, IListConfig config) { if (config != null) { comboBox.ListConfig = config.GetListConfig(); } }
public static void InitializeListConfig(this Store store, IListConfig config) { if (config != null) { config.AddModelFields(store.Model.Primary.Fields); var ajaxProxy = store.Proxy.Primary as AjaxProxy; if (ajaxProxy != null) { ajaxProxy.ExtraParams[AutoCompleteHandler.ComboBoxView] = config.GetType().AssemblyQualifiedName; } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (!string.IsNullOrEmpty(ComboboxView)) { var type = BuildManager.GetType(ComboboxView, true, true); ComboboxViewListConfig = (IListConfig)Activator.CreateInstance(type); } var width = new Unit(Width.Value - ((Padding ?? 0) * 4), UnitType.Pixel); LookupBox = new LookupBox { ID = "combo" + ID, DisplayField = "RowName", ValueField = "id", StoreID = MembersStoreID, QueryCaching = false, Hidden = ReadOnly, ReadOnly = ReadOnly, MultipleSelect = true, }; LookupBox.InitializeListConfig(ComboboxViewListConfig); _containerLookupBox = new Container { ID = "container" + LookupBox.ID, }; if (width.Value > 0) { LookupBox.Width = width; } else { _containerLookupBox.Layout = "Fit"; } _containerLookupBox.Items.Add(LookupBox); GridPanel = new GridPanel { ID = "grid" + ID, StoreID = ValuesStoreID, HideHeaders = true, Height = GridHeight ?? GetDefaultGridHeight(), }; var containerGridPanel = new Container { ID = "container" + GridPanel.ID, }; if (width.Value > 0) { GridPanel.Width = width; } else { containerGridPanel.Layout = "Fit"; } containerGridPanel.Items.Add(GridPanel); GridPanel.View.Add(new GridView()); GridPanel.SelectionModel.Add(new RowSelectionModel { Mode = SelectionMode.Multi }); if (!string.IsNullOrEmpty(OnChangedValuesFn)) { SetOnChangedValuesFn(); } if (!string.IsNullOrEmpty(MembersStoreID)) { LookupBox.Listeners.Change.Handler = string.Format( @" if (newValue != null && newValue != '') {{ var newRow = #{{{3}}}.getById(newValue); if (newRow != null) {{ var defaultData = {{RowName: newRow.data.RowName, Value: newRow.data.id}}; var newRecord = #{{{0}}}.insert(0, defaultData); var field = #{{{1}}}; var fn = field.{2}; if (fn != null) fn(field.getValue()); #{{{4}}}.setValue(null); field.fireEvent('change', field); }} }}", ValuesStoreID, ID, ScriptFunctionConstant.OnChangedValues, MembersStoreID, LookupBox.ID); } ViewCommand = GetViewCommand(); GridPanel.ColumnModel.Add(ViewCommand); DeleteCommand = GetDeleteCommand(); GridPanel.ColumnModel.Add(DeleteCommand); DataColumn = new Column { DataIndex = "RowName", Text = Properties.Resources.SSelectedItems, Flex = 1, Wrap = true, }; GridPanel.ColumnModel.Add(DataColumn); HiddenInsertedValues = new Hidden { ID = "hiddenInsertedValues" + ID }; HiddenDeletedValues = new Hidden { ID = "hiddenDeletedValues" + ID }; HiddenFilters = new Hidden { ID = ID + "Filters" }; LabelErrorText = new Label { ID = "labelErrorText" + ID, Text = string.Format(Web.Controls.Properties.Resources.SRequiredFieldMessage, FieldLabel), Hidden = true, Icon = Icon.Error }; LabelErrorText.Style.Add("color", "red"); BeforeElementText = new Label { ID = "beforeElementText" + ID, Hidden = true }; BeforeElementText.Style.Add("color", "blue"); /*Items.Add(LookupBox); * Items.Add(GridPanel);*/ Items.Add(BeforeElementText); Items.Add(_containerLookupBox); Items.Add(containerGridPanel); Items.Add(HiddenInsertedValues); Items.Add(HiddenDeletedValues); Items.Add(HiddenFilters); Items.Add(LabelErrorText); var store = LookupBox.GetStore(); store.Listeners.BeforeLoad.Handler += string.Format( @"store.getProxy().extraParams.parameters = GetExtNetLookupFilters(#{{{0}}});", HiddenFilters.ID); store.InitializeListConfig(ComboboxViewListConfig); LookupBox.LookupFiltersID = HiddenFilters.ID; dataSource = (EditableListDataSource)GridPanel.FindControl(GridPanel.GetStore().DataSourceID); }
public static void InitializeListConfig(this SelectColumnParameters selectColumnParameters, IListConfig config) { }
public static void InitializeListConfig <TKey>(this BaseDataSourceView <TKey> view, IListConfig config) where TKey : struct { if (config != null) { foreach (var column in config.Columns) { view.SetLookupVisible(column.ServerMaping, true); } } }
public static void InitializeListConfig <TKey>(this BaseDataSource <TKey> source, IListConfig config) where TKey : struct { if (config != null) { InitializeListConfig(source.BaseView, config); } }