public static void InitializeSelectMode(this TablePanel tablePanel, MainPageUrlBuilder url, string storeLoadHandler) { var gridPanel = tablePanel as GridPanel; var treePanel = tablePanel as TreePanel; if (gridPanel != null) { gridPanel.GetStore().Listeners.Load.Handler = (string.IsNullOrEmpty(storeLoadHandler) ? string.Empty : storeLoadHandler + "; ") + "GridStoreLoadHandler(#{grid}, store, #{SelectIDHidden});"; } if (url.IsSelect && !url.IsMultipleSelect) { var selectionModel = (RowSelectionModel)tablePanel.GetSelectionModel(); selectionModel.Mode = SelectionMode.Single; selectionModel.Visible = false; var handler = " if (e.target.className == null || e.target.className.indexOf('x-action') == -1) window.frameElement.addSelectedValues(record.data);"; if (gridPanel != null) { gridPanel.Listeners.ItemClick.Handler = handler; } if (treePanel != null) { treePanel.Listeners.ItemClick.Handler = handler; } ResourceManager.AddInstanceScript(string.Format("setFrameElementSelectedRecords({0})", tablePanel.ClientID)); } if (url.IsMultipleSelect) { var selectionModel = (RowSelectionModel)tablePanel.GetSelectionModel(); selectionModel.Mode = SelectionMode.Single; selectionModel.Visible = false; string handler = @" var userGrid = #{selectedUserValues}; var hasSameRow = userGrid.store.getById(record.data.id) != undefined; if (!hasSameRow){ userGrid.store.add({id: record.data.id, RecordName: record.data.RowName}); }"; if (gridPanel != null) { gridPanel.Listeners.ItemClick.Handler = handler; } if (treePanel != null) { treePanel.Listeners.ItemClick.Handler = handler; } ResourceManager.AddInstanceScript( string.Format( "setFrameElementSelectedRecordsForUserGrid({0});", tablePanel.Parent.NamingContainer.FindControl("selectedUserValues").ClientID)); } }
protected override void OnPreRenderExt() { base.OnPreRenderExt(); if (!IsPostBack) { if (LocalizationHelper.IsCultureKZ) { ResourceManager.AddInstanceScript(Properties.ResourceFiles.ExtLocaleKz); } ResourceManager.AddInstanceScript(Properties.ResourceFiles.GlobalScripts); } }
public static void SetTheme(Theme theme) { string themeName = theme == Ext.Net.Theme.Default ? "blue" : theme.ToString().ToLowerInvariant(); ResourceManager.AddInstanceScript("Ext.net.ResourceMgr.setTheme(\"{0}\", \"{1}\");", MvcResourceManager.GetThemeUrl(theme), themeName); }