zg-param

ZingGrid has a predefined set of param name values which have default behavior fetching and recieving data.

Usage

zg-param name values are an extension of the ZingGrid library and are used to increase and alter fetching data or altering data on return from fetch.

CloseCopy Copied
<zing-grid
  caption="Star Wars API"
  pager
  page-size="5"
  layout="row"
  layout-controls="disabled"
  viewport-stop>
  <zg-data>
    <!-- define the main source for the API -->
    <zg-param name="src" value="https://swapi.co/api/people/"></zg-param>

    <!-- define the path in the JSON to get the array of results.
        In this case it is body.results -->
    <zg-param name="recordPath" value="results"></zg-param>

    <!-- if loadByPage is set to true it will go to the
      server for each new page of data -->
    <zg-param name="loadByPage" value="true"></zg-param>

    <!-- define the "page" query parameter -->
    <zg-param name="pageKey" value="page"></zg-param>

    <!-- Need to tell ZG how many records were returned so it knows
        how to divide up the page-size -->
    <zg-param name="countPath" value="count"></zg-param>

    <!-- define the path in the result JSON to find next/prev urls -->
    <zg-param name="nextPath" value="next"></zg-param>
    <zg-param name="prevPath" value="previous"></zg-param>
  </zg-data>
</zing-grid>

Name Values

Detailed information about the name values used in <zg-param>. The example input column demonstrates the type of value to feed to name attribute. While related attributes column shows other params that usually go in conjuction with the current one.

Demo

Edit
Download
CloseCopy Copied
CloseCopy Copied
CloseCopy Copied
loadingloadBgloadBgloadBgloadBgloadBgloadBgloadBgloadBgloadBgloadBgloadBgloadBgloadBgloadBgloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloadingloading