How To
Documentation
    Learn More

      QueryService

      Description

      Twigkit service for queries

      Methods

      • clearQueries()

        Will remove all the queries from the factory.

        Example

        QueryService.clearQueries();

      • convertHttpParamsToQuery(httpParams)

        Converts http params to query value..

        Parameters
        ParamTypeDetails
        httpParamsobject

        The httpParams of the query.

        Example

        QueryService.convertHttpParamsToQuery(value);

      • convertHttpParamsToUrl(httpParams)

        Converts http params into a URL.

        Parameters
        ParamTypeDetails
        httpParamsobject

        A query object as http params

        Example

        QueryService.convertHttpParamsToUrl(query, true);

      • convertQueryToHttpParams(query, excludeHiddenFilters)

        Converts an object based query to HTTP Params.

        Parameters
        ParamTypeDetails
        queryobject

        Query to convert

        excludeHiddenFilters
        (optional)
        boolean

        Whether to include hidden filters in the params.

        Returns
        object

        Returns the query object as http params.

        Example

        QueryService.convertQueryToHttpParams(query);

      • convertQueryToUrl(query, includeHiddenFilters)

        Converts query object into a URL, encoding necessary values correctly and optionally removing hidden filters

        Parameters
        ParamTypeDetails
        queryobject

        The query object.

        includeHiddenFiltersboolean

        Whether to include hidden filters in the URL

        Example

        QueryService.convertQueryToUrl(query, true);

      • convertSortObjectToParam()

        Will convert sort object into an parameter.

        Example

        QueryService.convertSortObjectToParam(obj);

      • convertSortParamToObject()

        Will convert sort parameter into an object.

        Example

        QueryService.convertSortParamToObject(param);

      • getQuery(name)

        Gets the value of the query from the factory. If no query is found, the factory will return null.

        Parameters
        ParamTypeDetails
        namestring

        Name of the query to retrieve.

        Returns
        object

        Returns the query object, if no query object exists it will return null.

        Example

        QueryService.getQuery(name);

      • getQueryAsHttpParams(name, excludeHiddenFilters)

        Gets the value of the query from the factory. If no query is found, the factory will return null.

        Parameters
        ParamTypeDetails
        namestring

        Name of the query to retrieve.

        excludeHiddenFilters
        (optional)
        boolean

        Whether to include hidden filters in the params.

        Returns
        object

        Returns the query object, if no query object exists it will return null.

        Example

        QueryService.getQueryAsHttpParams(name);

      • queryContainsFilterForField(query, fieldName, filter)

        Will identify if the query contains the filter.

        Parameters
        ParamTypeDetails
        queryobject

        The query object.

        fieldNamestring

        The name of the field

        filterobject

        The filter object

        Example

        QueryService.queryContainsFilterForField(query, fieldName, filter);

      • removeFiltersForField(query, fieldName)

        Will remove any filters relating to the field name

        Parameters
        ParamTypeDetails
        queryobject

        The query object.

        fieldNamestring

        The name of the field

        Example

        QueryService.removeFiltersForField(query, fieldName);

      • setQuery(name, value)

        Adds the query value to the factory.

        Parameters
        ParamTypeDetails
        namestring

        Name to store the query under.

        valueobject

        The value of the query.

        Example

        QueryService.setQuery(name,value);

      Events

      • query_name_updated

        When the query is set or changed Lightning will broadcast this message where name is the name of your query query_name_updated

        Type:

        broadcast

        Target:

        root scope