• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 124,  comments - 29,  trackbacks - 0
            1: 加GridLevelNode時(shí)注意加的位置!!!   不能一味的往頂層節(jié)點(diǎn)上加!
             2:一定要把新建的 view放到 viewCollection里面. this.gridControlUserTable.ViewCollection.Add(newGridView)
            3:新建的關(guān)系名一定要和新建的level保持一致!!!!
            4:注意GridView的更新(父GridView的更新)
              private void gridControlUserTable_DoubleClick(object sender, EventArgs e)
                    {
                        try
                        {
                            //gridView  datatable  GridLevelNode都用同一個(gè)名字
                            //ViewCaption中放類別, 1, 用戶相關(guān)表.  0, 用戶無(wú)關(guān)表
                            GridView curView = (DevExpress.XtraGrid.Views.Grid.GridView)gridControlUserTable.FocusedView; //當(dāng)前的GridView
                            curView.MasterRowExpanding += new MasterRowCanExpandEventHandler(curView_MasterRowExpanding);
                            curView.MasterRowExpanded += new CustomMasterRowEventHandler(curView_MasterRowExpanded);


                            string viewName = curView.Name;
                            string id = "view" + icount.ToString();
                            int ihandle = curView.FocusedRowHandle; //當(dāng)前的行號(hào)
                            DataRow dr = curView.GetDataRow(ihandle); //當(dāng)前的行


                            GridView newGridView = null;
                            DataTable newDataTable = null;
                            DevExpress.XtraGrid.GridLevelNode gridLevel = null;
                            icount++;
                            #region 頂層的gridView
                            if (curView.Name == "gridViewParent")//頂層的gridView
                            {
                                string tableEName = dr["tableEName"].ToString();
                                string supplierRelated = dr["supplierRelated"].ToString();

                                #region 頂層
                                newGridView = new GridView();
                                newGridView.Name = id;
                                newGridView.OptionsView.ShowGroupPanel = false;
                                newGridView.OptionsBehavior.Editable = false;
                                newGridView.OptionsDetail.ShowDetailTabs = false;
                                newGridView.OptionsCustomization.AllowColumnMoving = false;
                                newGridView.OptionsBehavior.AutoExpandAllGroups = true;
                                this.gridControlUserTable.ViewCollection.Add(newGridView);

                                RelatedTableRecord[] relatedTableInfoArray = null;
                                UnrelatedTableRecord[] unRelatedTableInfoArray = null;
                                if (supplierRelated == "1")//廠商相關(guān)
                                {

                                    relatedTableInfoArray = PublicFunction.GetRelatedTableInfos(tableEName, btime, etime);
                                    if (relatedTableInfoArray == null || relatedTableInfoArray.Length == 0)
                                    {
                                        return;
                                    }
                                    CollectCommon.SetGridViewColumn(newGridView, "Config\\CollectMonitor\\supplierRelatedColumn.xml", "/Head");
                                    newGridView.ViewCaption = "1";
                                }
                                else if (supplierRelated == "0")//廠商無(wú)關(guān)
                                {

                                    unRelatedTableInfoArray = PublicFunction.GetUnRelatedTableInfos(tableEName, "", btime, etime);
                                    if (unRelatedTableInfoArray == null || unRelatedTableInfoArray.Length == 0)
                                    {
                                        return;
                                    }
                                    CollectCommon.SetGridViewColumn(newGridView, "Config\\CollectMonitor\\supplierUnRelatedColumn.xml", "/Head");
                                    newGridView.ViewCaption = "0";
                                }

                                newDataTable = new DataTable(id);
                                CollectCommon.SetDataTableColumn(newGridView, newDataTable);
                                if (supplierRelated == "1")//廠商相關(guān)
                                {
                                    CollectCommon.FillTableData(newDataTable, relatedTableInfoArray);
                                }
                                else//廠商無(wú)關(guān)
                                {
                                    CollectCommon.FillTableData(newDataTable, unRelatedTableInfoArray);
                                }
                                ds.Tables.Add(newDataTable);

                                gridLevel = new DevExpress.XtraGrid.GridLevelNode();
                                gridLevel.LevelTemplate = newGridView;
                                gridLevel.RelationName = id;

                                gridControlUserTable.LevelTree.Nodes.Add(gridLevel);

                                DataRelation dataRelation = new DataRelation(id, ds.Tables["parent"].Columns["tableEName"], ds.Tables[id].Columns["tableEName"], false);
                                ds.Relations.Add(dataRelation);

                                newGridView.RefreshData();
                                gridViewParent.RefreshData();

                                #endregion
                            }
                            #endregion
                            #region 非頂層表
                            else//非頂層表
                            {
                                if (curView.ViewCaption == "1")//廠商相關(guān)表,再鉆取最后一層,廠商無(wú)關(guān)的信息表,就鉆取到頭了.
                                {
                                    #region
                                    string tableEName = dr["tableEName"].ToString();
                                    string supplier = dr["supplier"].ToString();
                                    UnrelatedTableRecord[] unRelatedTableInfoArray = null;
                                    unRelatedTableInfoArray = PublicFunction.GetUnRelatedTableInfos(tableEName, supplier, btime, etime);
                                    if (unRelatedTableInfoArray == null || unRelatedTableInfoArray.Length == 0)
                                    {
                                        return;
                                    }
                                    newGridView = new GridView();
                                    newGridView.Name = id;
                                    newGridView.OptionsView.ShowGroupPanel = false;
                                    newGridView.OptionsBehavior.Editable = false;
                                    newGridView.OptionsDetail.ShowDetailTabs = false;
                                    newGridView.OptionsCustomization.AllowColumnMoving = false;
                                    newGridView.OptionsBehavior.AutoExpandAllGroups = true;
                                    newGridView.ViewCaption = "0";
                                    this.gridControlUserTable.ViewCollection.Add(newGridView);

                                    CollectCommon.SetGridViewColumn(newGridView, "Config\\CollectMonitor\\supplierUnRelatedColumn.xml", "/Head");

                                    newDataTable = new DataTable(id);
                                    CollectCommon.SetDataTableColumn(newGridView, newDataTable);
                                    CollectCommon.FillTableData(newDataTable, unRelatedTableInfoArray);

                                    ds.Tables.Add(newDataTable);

                                    gridLevel = new DevExpress.XtraGrid.GridLevelNode();
                                    gridLevel.LevelTemplate = newGridView;
                                    gridLevel.RelationName = id;

                                    string parentTableName = curView.Name;
                                    string parentLevelName = curView.Name;

                                    //AddGridLevelNode(gridControlUserTable, parentLevelName, gridLevel);
                                    
                                    gridControlUserTable.LevelTree.Nodes[0].Nodes.Add(gridLevel);

                                    DataColumn[] parentColumns = new DataColumn[2];
                                    DataColumn[] childColumns = new DataColumn[2];
                                    parentColumns[0] = ds.Tables[parentTableName].Columns["tableEName"];
                                    parentColumns[1] = ds.Tables[parentTableName].Columns["supplier"];


                                    childColumns[0] = ds.Tables[id].Columns["tableEName"];
                                    childColumns[1] = ds.Tables[id].Columns["supplier"];

                                    DataRelation dataRelation = new DataRelation(id, parentColumns, childColumns, false);
                                    //DataRelation dataRelation = new DataRelation(id, parentColumns[0], childColumns[0], false);
                                    ds.Relations.Add(dataRelation);
                                    curView.RefreshData();
                                    
                                    #endregion
                                }
                                else if (curView.ViewCaption == "0")//廠商無(wú)關(guān)表
                                {

                                }
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message + ex.StackTrace);
                        }
                    }
            posted on 2010-04-17 18:04 天書 閱讀(4382) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理



            <2013年11月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            1234567

            常用鏈接

            留言簿(5)

            隨筆檔案

            文章分類

            文章檔案

            好友的Bolg

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            久久93精品国产91久久综合| 久久性生大片免费观看性| 国产成人精品免费久久久久| 一本色综合网久久| 久久99热这里只有精品国产| 久久精品国产亚洲av麻豆图片| 久久亚洲中文字幕精品一区| 四虎影视久久久免费观看| 久久综合偷偷噜噜噜色| 无码日韩人妻精品久久蜜桃| 日本久久久精品中文字幕| 国内精品久久久久久久涩爱| 无夜精品久久久久久| 久久国产乱子精品免费女| 亚洲午夜无码AV毛片久久| 久久国产色AV免费看| 亚洲а∨天堂久久精品| 久久精品国产第一区二区三区 | 久久国产美女免费观看精品| 亚洲伊人久久成综合人影院 | 精品久久人妻av中文字幕| 99久久国产免费福利| 奇米影视7777久久精品| 伊人久久大香线焦AV综合影院| 久久er国产精品免费观看8| 精品无码久久久久国产| 四虎国产精品免费久久5151| 日韩精品久久无码人妻中文字幕| 国产日韩久久久精品影院首页| 国产精品久久久久影院色| 亚洲精品无码久久千人斩| 亚洲乱码精品久久久久..| 国产精品国色综合久久| 国产综合精品久久亚洲| 人人狠狠综合久久亚洲高清| 久久久久久午夜精品| 国产精品美女久久久久| 久久精品这里只有精99品| 精品综合久久久久久97| 国产精品禁18久久久夂久| 国内精品伊人久久久影院|