Templating

Learn how to convert your html into a dynamic realtime application.

Fetch

Fetch, filter and render list's is done by applying fetch-collection to a container div and difining a template with in the container

<div fetch-collection="test" template_id="A unique id"></div>

Filter

Add attribute contenteditbale to any html and element and use it as an input. CoCreateJS also converts filter elements to collabrative rich text editors or a website builder.

<h1 type="text" collection="test" document_id="" name="name"></h1>

Render

Add attribute contenteditbale to any html and element and use it as an input. CoCreateJS also converts render elements to collabrative rich text editors or a website builder.

<h1 type="text" collection="test" document_id="" name="name"></h1>

Templating Attributes

  • template_id string required

    Template identifier. This attribute should be define.

  • fetch-collection string required

    Collection name to fetch data. It is required.

  • fetch-name string optional

    Define the field name to fetch array

    If this value defined, it will fetch the special field's value

  • fetch-limit string optional

    Fetch the item's count on page load or when updated. If attribute is empty or not used, total items will be fetch.

  • fetch-type string optional

    Available value: loadmore | scroll | total.

  • filter-name string optional

    Collections's field name for filter.

  • filter-value string optional

    Collection's field value for filter. If filter-name defined, this attribute should defined too

  • filter-value-type string optional

    string | raw . Default value is string

    raw case, it will make values array from string by "," separation

  • filter-operator string optional

    Define the filter operator.

    Operators: $includes | $range | $eq | $ne | $lt | $lte | $gt | $gte | $in | $nin | $geoWithin

  • export_type string optional

    To export the fetched data, This attribute will be use

    Available value: json | cvs

  • import string optional

    When import the file content into selected collection, This attribute will be use

    Available value: true

  • filter-sort-name string optional

    Field name to sorting.

  • filter-sort-direction string optional

    Available value: asc | desc.

    Fetch order value on page load or when updated. If attribute is empty or not used Default's to asc.

  • render_id string optional

    This value should define in template wrapper.

    Mulitple template case, render_id would use that generate new object by this value