@@ -113,6 +113,32 @@ scope.refreshByPage = function (page, size, addMode) {
113113 scope . selectAll = false ;
114114} ;
115115
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+
116142/** Gets first page */
117143scope . first = function ( ) {
118144 log . info ( "call method first inside ${entity.model.type}Controller for page: 0" ) ;
@@ -177,23 +203,6 @@ scope.searchItem = function() {
177203 showForm ( searchAside ) ;
178204} ;
179205
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-
197206/** Executes the Elastic search on the server side */
198207scope . startElasticSearch = function ( item ) {
199208 // get criteria
@@ -479,12 +488,7 @@ app.factory('${entity.model.type}RestService', function (${dollar}resource) {
479488 'create' : { method :'POST' , url : 'api/${entity.model.vars}/$str6' } ,
480489 'update' : { method :'PUT' , url : 'api/${entity.model.vars}/$str6' } ,
481490 '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 }
488492## dedicated method for system entities
489493#if ( $entity . model . type == "AppParameter" )
490494 , 'getParameter' : { method : 'GET' ,
0 commit comments