Advanced Concepts
The HTML Kit provides developers with easy ways to work with their data. It also provides more advanced functionalities.
Advanced Queries
Adding the class dv-get-all:inventory:products
will get you data from the table products
under the service inventory
. This is well explained here . Its possible to craft more advanced queries using the query parameters below:
Lets assume we have an inventory
service which has a table products
from which a query is being made
NB: Its possible to pair up multiple parameters for a query eg: class="dv-param:search:name^shoes-param:randomize:1-get-all:inventory:products
This will return results containing the name shoes in a random order. Also parameter values may be passed in via URL query strings . eg class="dv-param:search:searchQuery-get-all:inventory:products"
to make this more dynamic you may pass the searchQuery via the URL using a query string eg: mydevless.herokuapp.com/?searchQuery=name^shoes
this will replace searchQuery
with name^shoes
Intercepting Queried Data
Getting the records from a table and rendering it is straight forward. Sometimes you might want to pre-process this data before rendering. To do this you will have to intercept the query using the dvInterceptQueryResponse
hook and Javascript .
Eg: Lets say we will like to capi talize every name before rendering to screen
The dv-label
class serves as an identifier for the query data action and makes it possible to access the record from within JavaScript
Intercepting submitted Data
The example above describe the interception of data about to be submitted to DevLess and capitalizing the name before it finally gets to DevLess.
Last updated