public TrialPLDataTreeNewExt()
 {
     popupContainerControl = new PopupContainerControl();
     dataTree = new UserControlDataTreeExt();
     popupContainerControl.Controls.Add(dataTree);
     this.Properties.PopupControl = popupContainerControl;
     popupContainerControl.Size = dataTree.Size;
     this.Properties.PopupSizeable = false;
     this.Properties.ShowPopupCloseButton = false;
     dataTree.PopupContainerEdit = this;
     this.Properties.NullText = GlobalConst.NULL_TEXT;
 }
        public RepositoryItemDataTreeNewExt(XtraForm danhMucForm, GridView gridView, string btnCaption, UserControlDataTreeExt.GetValue function, string columnField, string TableName, int[] RootID, string ValueField, string IDParentField, string[] VisibleFields, string[] Captions, string getField)
        {
            init();
            dataTree.GridView = gridView;
            dataTree._BuildTree(danhMucForm,btnCaption,function, columnField, TableName, RootID, ValueField, IDParentField, VisibleFields, Captions, getField);
            int idValue;

            gridView.GotFocus += delegate(object sender, EventArgs e)
            {
                if (gridView.DataSource != null &&
                   !((DataView)gridView.DataSource).Table.Columns.Contains(columnField + getField))
                {
                    ((DataView)gridView.DataSource).Table.Columns.Add(new DataColumn(columnField + getField));
                }
            };
            gridView.CellValueChanged += delegate(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
            {
                if (e.Column.FieldName.Equals(columnField + getField))
                {
                    idValue = _getId(e.Value);
                    if (e.RowHandle < 0)
                    {
                        gridView.EditingValue = idValue;
                        gridView.SetRowCellValue(e.RowHandle, columnField, idValue);
                    }
                    else
                    {
                        DataRow dr = gridView.GetDataRow(e.RowHandle);
                        dr[columnField] = idValue;
                    }
                }
            };
            gridView.InitNewRow += delegate(object sender, InitNewRowEventArgs e)
            {
                gridView.SetRowCellValue(e.RowHandle, columnField + getField, dataTree.TreeListEditor.FocusedNode.GetValue(getField));
            };
        }
 private void init()
 {
     dataTree = new UserControlDataTreeExt();
     popupControl = new PopupContainerControl();
     this.PopupControl = popupControl;
     popupControl.Controls.Add(dataTree);
     popupControl.Size = dataTree.Size;
     this.PopupSizeable = false;
     this.ShowPopupCloseButton = false;
     this.Popup += new EventHandler(RepositoryDataTree_Popup);
     this.Leave += new EventHandler(RepositoryDataTree_Leave);
 }
 public RepositoryItemDataTreeNewExt(XtraForm danhMucForm, TreeList treeList,string btnCaption, UserControlDataTreeExt.GetValue function, string columnField, string TableName, int[] RootID, string ValueField, string IDParentField, string[] VisibleFields, string[] Captions, string getField)
 {
     init();
     dataTree.TreeList = treeList;
     dataTree._BuildTree(danhMucForm,btnCaption,function, columnField, TableName, RootID, ValueField, IDParentField, VisibleFields, Captions, getField);
     treeList.CellValueChanged += delegate(object sender, CellValueChangedEventArgs e)
     {
         if (e.Column.FieldName.Equals(columnField + getField))
         {
             DataRow dr = ((DataRowView)treeList.GetDataRecordByNode(e.Node)).Row;
             dr[columnField] = _getId(e.Value);
         }
     };
     treeList.GotFocus += delegate(object sender, EventArgs e)
     {
         if (treeList.DataSource != null &&
                 !((DataTable)treeList.DataSource).Columns.Contains(columnField + getField))
         {
             ((DataTable)treeList.DataSource).Columns.Add(new DataColumn(columnField + getField));
         }
     };
 }
示例#5
0
 public static RepositoryItemDataTreeNewExt CotDanhMucTreeExt(GridView gridView, GridColumn column, XtraForm danhMucForm, string btnCaption, UserControlDataTreeExt.GetValue function, string ColumnField, string TableName, int[] RootID, string ValueField, string IDParentField, string[] VisibleFields, string[] Captions, string getField)
 {
     column.FieldName = ColumnField + getField;
     RepositoryItemDataTreeNewExt dmExt = new RepositoryItemDataTreeNewExt(danhMucForm, gridView, btnCaption, function, ColumnField, TableName, RootID, ValueField, IDParentField, VisibleFields, Captions, getField);
     column.ColumnEdit = dmExt;
     return dmExt;
 }
 public void _init(XtraForm danhMucForm, string btnCaption, UserControlDataTreeExt.GetValue function,  string TableName, int[] RootID, string IDField, string IDParentField, string[] VisibleFields, string[] Captions, string getField)
 {
     dataTree._BuildTree(danhMucForm,btnCaption,function, TableName, RootID, IDField, IDParentField, VisibleFields, Captions, getField);
 }