File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
src/OneScript.StandardLibrary/Collections/ValueTable Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ This Source Code Form is subject to the terms of the
1717using ScriptEngine . Machine . Contexts ;
1818using System ;
1919using System . Collections . Generic ;
20+ using System . Data . Common ;
2021using System . Linq ;
2122
2223namespace OneScript . StandardLibrary . Collections . ValueTable
@@ -648,15 +649,19 @@ private List<ValueTableSortRule> GetSortRules(string Columns)
648649 if ( description . Length == 0 )
649650 throw ColumnException . WrongColumnName ( ) ;
650651 if ( description . Length > 2 )
651- throw RuntimeException . InvalidNthArgumentValue ( 1 ) ;
652-
653- var Desc = new ValueTableSortRule
652+ throw RuntimeException . InvalidNthArgumentValue ( 1 ) ;
653+
654+ var sortColumn = this . Columns . FindColumnByName ( description [ 0 ] ) ;
655+ if ( sortColumn == null )
656+ throw ColumnException . WrongColumnName ( description [ 0 ] ) ;
657+
658+ var rule = new ValueTableSortRule
654659 {
655- Column = this . Columns . FindColumnByName ( description [ 0 ] ) ,
660+ Column = sortColumn ,
656661 direction = ( description . Length > 1 && description [ 1 ] . BilingualEquals ( "УБЫВ" , "DESC" ) ) ? - 1 : 1
657662 } ;
658663
659- Rules . Add ( Desc ) ;
664+ Rules . Add ( rule ) ;
660665 }
661666
662667 return Rules ;
You can’t perform that action at this time.
0 commit comments