Example #1
0
        //----------------------------------------------------------------------------------------------------
        public void RowUI_OnOpenViewer(GridRow gridRow)
        {
            if (this.RecordViewerUI == null)
            {
                this.RecordViewerUI = new RecordViewerUI();
                this.RecordViewerUI.Instantiate();
                this.RecordViewerUI.OnClose.After.AddHandler(this, "RecordViewerUI_OnClose", 0);
                jRoot.append(this.RecordViewerUI.jRoot);
            }
            this.RecordViewerUI.Model        = gridRow;
            this.RecordViewerUI.GridResponse = this.Model;

            jF(".FrontLevelPage").hide();
            this.RecordViewerUI.Open();
        }
Example #2
0
        public void GetGrid_Return(ASPdb.Ajax.AjaxResponse response)
        {
            if (UI.Errors.ExceptionHandler.Check(response))
            {
                if (response.Error.Message == "Invalid FilterField." && !this.LastAttemptWas_InvalidFilterField)
                {
                    this.LastAttemptWas_InvalidFilterField    = true;
                    this.ViewModel.FilterAndSort              = new FilterAndSort();
                    this.ViewModel.FilterAndSort.FilterFields = new ViewOptions_FilterField[0];
                    this.ViewModel.FilterAndSort.SortFields   = new ViewOptions_SortField[0];
                    this.ViewOptions.BttnClick_ApplyAndRefresh();
                }
                else
                {
                    return;
                }
            }
            this.LastAttemptWas_InvalidFilterField = false;

            if (this.RecordViewerUI != null)
            {
                this.RecordViewerUI = null;
            }

            this.Model = response.ReturnObj.As <GridResponse>();

            document.title = "[" + this.Model.TableName + "] - ASPdatabase.NET";

            if (this.ViewModel.FilterAndSort.FilterFields != null && this.ViewModel.FilterAndSort.FilterFields.Length > 0)
            {
                this.GridToolBar.SetFilterCount(this.ViewModel.FilterAndSort.FilterFields.Length);
            }
            else if (this.ViewModel.FilterAndSort.SortFields != null && this.ViewModel.FilterAndSort.SortFields.Length > 0)
            {
                this.GridToolBar.SetFilterCount(0);
            }
            else
            {
                this.GridToolBar.SetFilterCount(-1);
            }

            this.ViewModel.SelectionCount = 0;
            this.ViewModel.AllColumnNames = new string[0];
            for (int i = 0; i < this.Model.HeaderItems.Length; i++)
            {
                this.ViewModel.AllColumnNames[i] = this.Model.HeaderItems[i].FieldName;
            }
            this.BindUI();

            this.GridToolBar.Model = this.Model;
            this.GridToolBar.Open();


            var tableGridTable = jF(".TableGridTable").html("");

            string headerHTML = "<tr>" + "<th class='SelectAllBox' title='Select/Deselect All'><span></span></th>" + "<th></th>";

            for (int i = 0; i < this.Model.HeaderItems.Length; i++)
            {
                headerHTML += JsStr.StrFormat1("<th>{0}</th>", this.Model.HeaderItems[i].FieldName);
            }
            headerHTML += "</tr>";
            tableGridTable.html(headerHTML);
            var thisObj  = this;
            var jRootObj = this.jRoot;

            eval("jRootObj.find('.SelectAllBox').click(function(){ thisObj.SelectAllBox_Click(); });");

            this.RowUIs = new RowUI[0];
            for (int i = 0; i < this.Model.Rows.Length; i++)
            {
                this.RowUIs[i]                    = new RowUI();
                this.RowUIs[i].IsOdd              = (i % 2 == 1);
                this.RowUIs[i].ViewModel          = this.ViewModel;
                this.RowUIs[i].Model              = this.Model.Rows[i];
                this.RowUIs[i].Model.DisplayIndex = i;
                this.RowUIs[i].OnSelection.After.AddHandler(this, "RowUI_OnSelection", 0);
                this.RowUIs[i].OnOpenViewer.After.AddHandler(this, "RowUI_OnOpenViewer", 1);
                this.RowUIs[i].Instantiate();
                tableGridTable.append(this.RowUIs[i].jRoot);
            }

            UI.PagesFramework.BasePage.WindowResized();
        }