ajax - Dynamically change search container results in liferay -


i think question similar how search inside of search container in liferay.

so page onload has jsp variable sets

<liferay-ui:search-container-results>     <%                       results = listutil.sublist(mylist, searchcontainer.getstart(), searchcontainer.getend());     total = mylist.size();     pagecontext.setattribute("results", results);     pagecontext.setattribute("total", total);     %> </liferay-ui:search-container-results> 

is there way dynamically change mylist through ajax? in backend filtering , returning json object replace mylist variable.

would appreciate assistance in how replace mylist variable , hence refresh searchcontainer table

even though questions seem related, want different him.

so answer question, implementation thinking of can not done. reason:

the mylist variable variable exists server side. javascript code runs on client side. have no way of manipulate content of java variable javascript.

what can done following:

after have retrieved json response, remove html result rows in search container , replace html generate in javascript. can little tricky, because want replicate html liferay-ui:search-container-results tag produces, because otherwise styling broken.

there 1 other way this. search results , display them , rest via javascript (pagination, search in table, etc.) example use this: https://www.datatables.net/

or

https://mottie.github.io/tablesorter/docs/example-pager-filtered.html

be warned, can little bit slow if reach critical point of entries displayed ;)


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -