@@ -113,6 +113,32 @@ scope.refreshByPage = function (page, size, addMode) {
113
113
scope . selectAll = false ;
114
114
} ;
115
115
116
+ /** Executes the search with criteria on the server side */
117
+ scope . startSearch = function ( item ) {
118
+ log . info ( "startSearch, criteria: " + scope . item ) ;
119
+
120
+ // call search on the server side and refresh the grid
121
+ $ { entity . model . var } RestService . search ( item , function success ( result ) {
122
+ log . info ( "receiving info from server side" ) ;
123
+
124
+ // refresh data and so the grid
125
+ scope . data = result . content ;
126
+
127
+ // fill pagination variables
128
+ scope . pagination . first = result . first ;
129
+ scope . pagination . last = result . last ;
130
+ scope . pagination . totalElements = result . totalElements ;
131
+ scope . pagination . totalPages = result . totalPages ;
132
+ scope . pagination . number = result . number ;
133
+
134
+ log . info ( "data post refresh:" + scope . data . length ) ;
135
+ log . info ( "page number: " + scope . pagination . number ) ;
136
+ } ) ;
137
+
138
+ // close the search aside
139
+ hideForm ( searchAside ) ;
140
+ } ;
141
+
116
142
/** Gets first page */
117
143
scope . first = function ( ) {
118
144
log . info ( "call method first inside ${entity.model.type}Controller for page: 0" ) ;
@@ -177,23 +203,6 @@ scope.searchItem = function() {
177
203
showForm ( searchAside ) ;
178
204
} ;
179
205
180
- /** Executes the classical search on the server side */
181
- scope . startSearch = function ( item ) {
182
- log . info ( "startSearch, criteria: " + scope . item ) ;
183
-
184
- // call search on the server side and refresh the grid
185
- $ { entity . model . var } RestService . search ( item , function success ( result ) {
186
- log . info ( "receiving info from server side" ) ;
187
-
188
- // refresh data and so the grid
189
- scope . data = result ;
190
- log . info ( "data post refresh:" + result ) ;
191
- } ) ;
192
-
193
- // close the search aside
194
- hideForm ( searchAside ) ;
195
- } ;
196
-
197
206
/** Executes the Elastic search on the server side */
198
207
scope . startElasticSearch = function ( item ) {
199
208
// get criteria
@@ -479,12 +488,7 @@ app.factory('${entity.model.type}RestService', function (${dollar}resource) {
479
488
'create' : { method :'POST' , url : 'api/${entity.model.vars}/$str6' } ,
480
489
'update' : { method :'PUT' , url : 'api/${entity.model.vars}/$str6' } ,
481
490
'delete' : { method :'DELETE' , url : 'api/${entity.model.vars}/$str6' } ,
482
- 'search' : { method : 'POST' , url : 'api/${entity.model.vars}/search/' , isArray : true ,
483
- transformResponse : function ( data ) {
484
- data = angular . fromJson ( data ) ;
485
- return data ;
486
- }
487
- }
491
+ 'search' : { method : 'POST' , url : 'api/${entity.model.vars}/search/' , isArray : false }
488
492
## dedicated method for system entities
489
493
#if ( $entity . model . type == "AppParameter" )
490
494
, 'getParameter' : { method : 'GET' ,
0 commit comments