@@ -31,6 +31,12 @@ WOQLTableConfig.prototype.json = function () {
3131 if ( typeof this . renderer ( ) !== 'undefined' ) {
3232 conf . renderer = this . renderer ( ) ;
3333 }
34+ if ( typeof this . filter ( ) !== 'undefined' ) {
35+ conf . filter = this . filter ( ) ;
36+ }
37+ if ( typeof this . filterable ( ) !== 'undefined' ) {
38+ conf . filterable = this . filterable ( ) ;
39+ }
3440 if ( typeof this . pager ( ) !== 'undefined' ) {
3541 conf . pager = this . pager ( ) ;
3642 }
@@ -68,6 +74,12 @@ WOQLTableConfig.prototype.loadJSON = function (config, rules) {
6874 if ( typeof config . renderer !== 'undefined' ) {
6975 this . renderer ( config . renderer ) ;
7076 }
77+ if ( typeof config . filter !== 'undefined' ) {
78+ this . filter ( config . filter ) ;
79+ }
80+ if ( typeof config . filterable !== 'undefined' ) {
81+ this . filterable ( config . filterable ) ;
82+ }
7183 if ( typeof config . bindings !== 'undefined' ) {
7284 this . bindings ( config . bindings ) ;
7385 }
@@ -111,6 +123,27 @@ WOQLTableConfig.prototype.prettyPrint = function () {
111123 return str ;
112124} ;
113125
126+ /**
127+ * @param {boolean } canfilter
128+ * @returns WOQLTableConfig
129+ */
130+
131+ WOQLTableConfig . prototype . filterable = function ( canfilter ) {
132+ if ( ! canfilter && canfilter !== false ) return this . tfilterable ;
133+ this . tfilterable = canfilter ;
134+ return this ;
135+ } ;
136+
137+ /*
138+ * default is string
139+ * filter type number | list | date
140+ */
141+ WOQLTableConfig . prototype . filter = function ( filter ) {
142+ if ( ! filter ) return this . tfilter ;
143+ this . tfilter = filter ;
144+ return this ;
145+ } ;
146+
114147WOQLTableConfig . prototype . renderer = function ( rend ) {
115148 if ( ! rend ) return this . trenderer ;
116149 this . trenderer = rend ;
@@ -196,6 +229,22 @@ WOQLTableRule.prototype.header = function (hdr) {
196229 return this ;
197230} ;
198231
232+ WOQLTableRule . prototype . filter = function ( hdr ) {
233+ if ( typeof hdr === 'undefined' ) {
234+ return this . rule . filter ;
235+ }
236+ this . rule . filter = hdr ;
237+ return this ;
238+ } ;
239+
240+ WOQLTableRule . prototype . filterable = function ( hdr ) {
241+ if ( typeof hdr === 'undefined' ) {
242+ return this . rule . filterable ;
243+ }
244+ this . rule . filterable = hdr ;
245+ return this ;
246+ } ;
247+
199248WOQLTableRule . prototype . width = function ( wid ) {
200249 if ( typeof wid === 'undefined' ) {
201250 return this . rule . width ;
0 commit comments