@@ -32,6 +32,12 @@ public class GridBuilder<T>
3232 internal bool _processing { get ; private set ; } = true ;
3333 internal bool _scrollX { get ; private set ; }
3434
35+ internal bool _selectEnable { get ; private set ; }
36+ internal SelectStyle _selectStyle { get ; private set ; }
37+ internal SelectItems _selectItems { get ; private set ; }
38+ internal bool _selectInfo { get ; private set ; }
39+ internal bool _selectToggleable { get ; private set ; }
40+
3541 internal List < ColumnDefinition > _columns = new List < ColumnDefinition > ( ) ;
3642 internal List < FilterDefinition > _filters = new List < FilterDefinition > ( ) ;
3743 internal List < OrderDefinition > _orders = new List < OrderDefinition > ( ) ;
@@ -342,5 +348,84 @@ public GridBuilder<T> ScrollX(bool scrollX)
342348 _scrollX = scrollX ;
343349 return this ;
344350 }
351+
352+ /// <summary>
353+ /// Enable selection and set properties
354+ /// </summary>
355+ /// <param name="enable">Enable the selectable grid, default is false.</param>
356+ /// <param name="items">Set the selection behaviour.</param>
357+ /// <param name="style">Set the selection style.</param>
358+ /// <param name="info">Disable the visibility of selected row info on grid, default is true.</param>
359+ /// <param name="toggleable">Disable the toggleable selection, default is true.</param>
360+ /// <returns></returns>
361+ public GridBuilder < T > Selecting ( bool enable , SelectItems items , SelectStyle style , bool info , bool toggleable )
362+ {
363+ _selectEnable = enable ;
364+ _selectItems = items ;
365+ _selectStyle = style ;
366+ _selectInfo = info ;
367+ _selectToggleable = toggleable ;
368+
369+ if ( items == SelectItems . Checkbox )
370+ {
371+ var column = new ColumnDefinition
372+ {
373+ ClassName = "select-checkbox" ,
374+ Orderable = false ,
375+ Searchable = false ,
376+ Width = 5 ,
377+ Render = null
378+ } ;
379+ _columns . Insert ( 0 , column ) ;
380+ }
381+
382+ return this ;
383+ }
384+
385+ /// <summary>
386+ /// Enable selection and set properties
387+ /// </summary>
388+ /// <param name="enable"></param>
389+ /// <param name="items"></param>
390+ /// <param name="style"></param>
391+ /// <param name="info"></param>
392+ /// <returns></returns>
393+ public GridBuilder < T > Selecting ( bool enable , SelectItems items , SelectStyle style , bool info )
394+ {
395+ return Selecting ( enable , items , style , info , true ) ;
396+ }
397+
398+ /// <summary>
399+ /// Enable selection and set properties
400+ /// </summary>
401+ /// <param name="enable"></param>
402+ /// <param name="items"></param>
403+ /// <param name="style"></param>
404+ /// <returns></returns>
405+ public GridBuilder < T > Selecting ( bool enable , SelectItems items , SelectStyle style )
406+ {
407+ return Selecting ( enable , items , style , true , true ) ;
408+ }
409+
410+ /// <summary>
411+ /// Enable selection and set properties
412+ /// </summary>
413+ /// <param name="enable"></param>
414+ /// <param name="items"></param>
415+ /// <returns></returns>
416+ public GridBuilder < T > Selecting ( bool enable , SelectItems items )
417+ {
418+ return Selecting ( enable , items , SelectStyle . Default , true , true ) ;
419+ }
420+
421+ /// <summary>
422+ /// Enable selection and set properties
423+ /// </summary>
424+ /// <param name="enable"></param>
425+ /// <returns></returns>
426+ public GridBuilder < T > Selecting ( bool enable )
427+ {
428+ return Selecting ( enable , SelectItems . Row , SelectStyle . Default , true , true ) ;
429+ }
345430 }
346431}
0 commit comments