File tree Expand file tree Collapse file tree 4 files changed +52
-9
lines changed Expand file tree Collapse file tree 4 files changed +52
-9
lines changed Original file line number Diff line number Diff line change 692
692
}
693
693
} ,
694
694
695
- buildRequest : function ( paging )
695
+ getFilterValues : function ( )
696
696
{
697
- var filters = $ ( ".griddly-filters input, .griddly-filters select" , this . $element ) ;
697
+ var allFilters = $ ( ".griddly-filters input, .griddly-filters select" , this . $element ) . add ( this . $inlineFilters ) ;
698
+
699
+ return serializeObject ( allFilters ) ;
700
+ } ,
698
701
699
- filters = filters . add ( this . $inlineFilters ) ;
702
+ setFilterValues : function ( filters , isPatch )
703
+ {
704
+ if ( isPatch !== true )
705
+ {
706
+ var allFilters = $ ( ".griddly-filters input, .griddly-filters select" , this . $element ) . add ( this . $inlineFilters ) ;
700
707
701
- var postData = serializeObject ( filters ) ;
708
+ allFilters . each ( function ( )
709
+ {
710
+ $ ( this ) . val ( filters [ this . name ] ) . change ( ) ;
711
+ } ) ;
712
+ }
713
+ else
714
+ {
715
+ for ( var key in filters )
716
+ $ ( "[name='" + key + "']" ) . val ( filters [ key ] ) . change ( ) ;
717
+ }
718
+ } ,
719
+
720
+ buildRequest : function ( paging )
721
+ {
722
+ var postData = this . getFilterValues ( ) ;
702
723
703
724
if ( this . options . sortFields . length )
704
725
{
Original file line number Diff line number Diff line change 5
5
6
6
@Html.Griddly(new GriddlySettings<TestGridItem >()
7
7
{
8
- PageSize = 5
8
+ PageSize = 5 ,
9
+ ClassName = " filter-range-grid"
9
10
}
10
11
.Column(x => x.FirstName, "First Name", defaultSort: SortDirection.Ascending)
11
12
.Column(x => x.LastName, "Last Name")
Original file line number Diff line number Diff line change 5
5
<div class =" jumbotron" >
6
6
<h1 >Griddly</h1 >
7
7
@* <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
8
- <p><a href="http://asp.net" class="btn btn-primary btn-large">Learn more »</a></p>
9
- *@
8
+ <p><a href="http://asp.net" class="btn btn-primary btn-large">Learn more »</a></p>
9
+ *@
10
10
</div >
11
11
12
12
<div class =" row" >
13
13
<div class =" col-md-12" >
14
14
@Html.Griddly( "FilterBoxGrid", new { test = SortDirection .Ascending } )
15
+ <br />
16
+ <a href =" javascript:GetFilterValues()" >get filter values</a > | <a href =" javascript:SetFilterValues()" >set filter values</a >
15
17
@Html.Griddly( "FilterRangeGrid")
18
+ <br />
16
19
@Html.Griddly( "FilterListGrid")
20
+ <br />
17
21
@Html.Griddly( "TestGrid")
18
22
</div >
19
23
</div >
27
31
for (var k in result)
28
32
str += " " + k + " : [ " + result[k].toString () + " ]\n " ;
29
33
str += " }" ;
30
-
34
+
35
+ alert (str);
36
+ }
37
+
38
+ function GetFilterValues ()
39
+ {
40
+ var result = $ (" .filter-range-grid" ).griddly (" getFilterValues" );
41
+
42
+ var str = " {\n " ;
43
+ for (var k in result)
44
+ str += " " + k + " : [ " + result[k].toString () + " ]\n " ;
45
+ str += " }" ;
46
+
31
47
alert (str);
32
48
}
49
+
50
+ function SetFilterValues ()
51
+ {
52
+ $ (" .filter-range-grid" ).griddly (" setFilterValues" , { companyStart: ' 53' } );
53
+ }
33
54
</script >
Original file line number Diff line number Diff line change 1
1
@using Griddly .Mvc ;
2
2
3
3
@{
4
- GriddlySettings .DefaultClassName = " table table-bordered table-hover" ;
4
+ // GriddlySettings.DefaultClassName = "table table-bordered table-hover";
5
5
}
6
6
You can’t perform that action at this time.
0 commit comments