Search WebPart

Input Parameters

Name Type Description
camlQuery string The CAML query to apply to the query for getting the list items.
cfgElementId string The optional configuration element id
className string The class name to apply to the target element.
elementId string The target element id to render the webpart to
editPanel IWebPartEditPanel The edit panel.
helpProps { title?: string, url: string } The optional help link.
listQuery ODataQuery The OData query to apply to the query for getting the list.
oData ODataQuery The OData query to apply to the query for getting the list items.
onExecutingCAMLQuery (wpInfo: IWPSearchInfo, caml: string) => string The render CAML query event executed before getting the list items.
onExecutingODATAQuery (wpInfo: IWPSearchInfo, odata: ODataQuery) => ODataQuery The render CAML query event executed before getting the list items.
onPostRender (wpInfo: IWebPartInfo, , list?: IListQueryResult or IListResult) => void The post render event.
onRenderDisplay (wpInfo: IWebPartInfo) => any The render event triggered when the page is in ‘Display’ mode.
onRenderEdit (wpInfo: IWebPartInfo) => any The render event triggered when the page is in ‘Edit’ mode.
onRenderItems (wpInfo: IWebPartInfo, items: Array<IListItemQueryResult or IListItemResult>) => any The render event triggered after the items query executes.
onSave (cfg: IWPSearchCfg) => IWPSearchCfg The save configuration event.
wpClassName string The class name to apply to the div element containing the webpartid property.

WebPart Edit Panel

Name Type Description
listQuery ODataQuery The OData query to apply to the query for getting the lists.
onListChanged (wpInfo: IWPSearchInfo, list?: IListQueryResult or IListResult) The list changed event.
onListsRendering (wpInfo: IWPSearchInfo, lists?: Array<IListQueryResult or IListResult>) The lists rendering event.
onRenderFooter (el:HTMLDivElement, wpInfo: IWPSearchInfo, list?: IListQueryResult or IListResult) The render footer event.
onRenderHeader (el:HTMLDivElement, wpInfo: IWPSearchInfo, list?: IListQueryResult or IListResult) The render header event.
onSave (wpCfg: IWPSearchCfg) The save event.

JavaScript

var $REST = require("gd-sprest-js");

export const MySearchWebPart = function(){
    // Create the search webpart
    $REST.JS.WebParts.WPSearch({
        elementId: "wp-list",
        cfgElementId: "wp-list-cfg",
        wpClassName: "fabric",
        onRenderItems: function(wpInfo, items) {
            // Render the webpart
        }
    });
}

TypeScript

import { Fabric, WebParts } from "gd-sprest-js";

export const MyListWebPart = function(){
    // Create the search webpart
    WebParts.WPSearch({
        elementId: "wp-list",
        cfgElementId: "wp-list-cfg",
        wpClassName: "fabric",
        onRenderItems: function(wpInfo, items) {
            // Render the webpart
        }
    });
}