Ejemplo n.º 1
0
        /// <summary>
        /// 得到ChildColumns中的集合,用,号分开
        /// Get ChildSequence no respect to the GridColumns for ChildColumns in StackedHeaderRow
        /// </summary>
        /// <param name="column"></param>
        /// <param name="rowIndex"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static List <int> GetChildSequence(this SfDataGrid sfgrid, StackedColumn column, int rowIndex)
        {
            List <int> childSequencNo = new List <int>();

            if (column != null)
            {
                var childColumns = column.ChildColumns.Split(',');
                foreach (var child in childColumns)
                {
                    bool bFound         = false;
                    var  currentColumns = sfgrid.Columns;
                    for (int i = 0; i < currentColumns.Count; ++i)
                    {
                        if (currentColumns[i].MappingName == child)
                        {
                            childSequencNo.Add(i);
                            bFound = true;
                            break;
                        }
                    }
                    if (!bFound)
                    {
                        var childSubSequence = sfgrid.GetChildSequence(sfgrid.GetStackedColumn(child, rowIndex + 1), rowIndex);
                        childSequencNo = childSequencNo.Union(childSubSequence).ToList();
                    }
                }
                return(childSequencNo);
            }
            return(childSequencNo);
        }