Skip to main content
Kinetic Community

Data Viewer Options (CE)

)Description

Configuration and options are provided to Data Viewer via a nested JSON.  Name:Value pairs provide Data Viewer with the desired behaviors.

resource:   (nested JSON schema)
  name: (String) 
Name of Bridge Resource
  parameters: (Not used)
data:   (Array of 1 or more nested JSON schemas)
When using DataTabes column options may be passed through to it.  More info at https://datatables.net/reference/option/columns
  name: (String) 
Name matches to data returned in the results
  title: (String) 
(Optional) Title is used for display purposes to identify the data to the user
  class: (String) 
(Optional) HTML class of the values DOM element
  setField: (String) 
(Optional) A field on the Form to receive the selected value upon click.
  defaultContent: (String)
(Optional) A text or HTML string that will be the defaulted value in the displayed results.  The value here will appear will all results sets.  This can be used when the data to be displayed doesn't come from the search results.
  render: (Function ( data, type, record ))
(Optional) Used to modify the value of the data before display.  The results returned from this function will be displayed in the results.  
Parameters
renderer:   (nested JSON schema)
  type:

(Function)
A function to render the results of the search.   "KDSearch.Renderers.DataTables" and "KDSearch.Renderers.UnorderedList" included with the library.  A custom function may also be supplied instead.

DataTables

UnorderList

  options: (Nested JSON schema)
Values supplied here are specific to the Renderer and define the behavior of the Renderer.
before: (Function) 
(Optional) A function to execute before the search is performed
success: (Function) 
(Optional) A function to execute after the search is performed but before processing the data
successEmpty: (Function) 
(Optional) A function to execute after the search is performed when no results are returned
error: (Function) 
(Optional) A function to execute when an error is returned from the search
complete: (Function) 
(Optional) A function to execute after the search is performed and after the results are processed.  Executes after success and error.
clickCallback:

(Function) 
(Optional) A function to execute when the results are clicked.

Returns element click (jQuery Obj), selected results (JSON)

resultsContainerId:

(String) 
Supply an arbitrary value which will be applied to the DataTable element id when it is created.   This value is be applied to the id attribute of the DataTable.  

Example: 

resultsContainerId: 'sampleTable' 

will result in;

<table id="sampleTable" >
removeOnClick: (Boolean) 
(Optional defaulted "true") "true" or "false"  value to indicate if the search results should removed from display after a result is clicked.

Example:

resource:{
    name: "Sample People",
},
data: [
    { 
        title:"<input type='checkbox' class='editor-active'>",    
        defaultContent:"<input type='checkbox' class='editor-active'>",
        class:"control",
    },
    { 
        defaultContent: 'static',
        title:"static text",
        class: 'all',
    },
    { 
        name: "First Name",
        title:"FIRST",
        class: "all",
        setField:"First Name",
    },
    { 
        name: "Last Name",
        title:"Last",
        class: "min-tablet",
        callback:function(value){
            console.log(value);
        },
        setField:"Last Name"
    },
    { 
        name: "Email",
        title:"EMAIL",
        class: "min-phone",
        setField:"Email",
    },
    { 
        name: "Login Id",
        title:"LOGIN",
        class: "none",
        setField:"Login Id"
    },
    { 
        name: "Phone Number",
        title:"PHONE",
        class: "hidden",
        setField:"Phone Number",
    }
],
resultsContainerId: 'requestedForTable',
before: function(configObj){    
    K('field[Requested For Someone Else]').value($('#search-requestedfor-someone-else input').val());
},
success: function (configObj){
},
successEmpty: function(configObj){
},
error: function(configObj){
},
complete: function(configObj){
},
clickCallback: function(results){
},
removeOnClick: true,
renderer: {
    type: KDSearch.Renderers.DataTables,
    options: {
        processSingleResult: true,
        responsive: true,
        fnFooterCallback: function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
        },
        dom: 'Bfrtip',
        createdRow: function ( row, data, index ) {
        },
        pageLength: 15,
    }
},