Skip to main content
Kinetic Community

Data Viewer Options (RE)

Description

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

type:  
(String)
Defines the type of search to be used and how to display the results.
Valid options are:
  • "BridgeDataTable" - Search is performed using a Bridge and results are displayed in a Data Table.
  • "BridgeList" - Search is performed using a Bridge and results are displayed in a List.
  • "BridgeGetSingle" - Search is performed using a Bridge and Bridge is configured to return 1 result.
  • "performSDRTable" - Search is performed using a Simple Data Request and results are displayed in a Data Table.
responsive name:
(Boolean) 
(Optional) Default for "BridgeDataTable" is true but can be over written.
bridgeConfig:  
 
  model:
(String)
The name of the model to be used
  qualification_mapping:
(String)
The qualification mapping to be used. NOTE: that this bridge and qualification mapping must be exposed on the service item.
  parameters:
(String, jQuery Selector or Function-returning a String)
The parameters to be passed to the Bridge.  
examples:
  • String: "Sam",
  • jQuery Selector: "#element_id"
  • Function: function(){return KD.utils.Action.getQuestionValue('Requested For');},
  metadata:
(Optional)
Bridge metadata settings can be passed through to the Bridge
data:  
(Array of 1 or more nested JSON schemas)
When using DataTabes column options may be passed through to it. (ie: "defaultContent: or render:") More info at: https://datatables.net/reference/option/columns
  name:  
(String) 
Value matches to Attributes configured in the Bridge
    title:
(String) 
(Optional for Lists) Title is used for display purposes to identify the data to the user
   

className:

(String) 
(Optional) HTML class of the values DOM element
    setQstn :
(String) 
(Optional) A field on the Form to receive the selected value upon click.
    callback: (Function) 
(Optional) Callback for after the question is set upon result selection
    notdynamic:
(Optional)
Indicates this is not a value returned from the Bridge Search.  Defaults to false
processSingleResult:  
(Boolean)
(Optional) Defaults to false.  If true and a single result returned, no results are displayed and behavior will mimic click of the single result.
appendTo :  
(JQuery Selector)
Where to append the table. Must be a jQuery selector or function which returns a string value.
resultsContainerId:  
(String)
ID to give the table when creating it.
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)

Example:

requestedForTableConfig = {
      type: "BridgeDataTable",
      responsive: false,
      bridgeConfig:{
          model: "Person",
          qualification_mapping: "By First Name or Last Name or Full Name",
          parameters: {
            'Full Name': function(){return KD.utils.Action.getQuestionValue('Requested For');},
            'First Name': function(){return KD.utils.Action.getQuestionValue('Requested For');},
            'Last Name': function(){return KD.utils.Action.getQuestionValue('Requested For');}
          },
          metadata: {"order": [encodeURIComponent('<%=attribute["Last Name"]%>:ASC')] },
      },
      processSingleResult: true,
      data: {
          "First Name":{
              title:"FIRST",
              className: "all",
              setQstn:"ReqFor_First Name",
              callback:function(value){
                  console.log(value);
              },
              notdynamic: false
          },
          "Last Name":{
              title:"Last",
              className: "min-tablet",
              setQstn:"ReqFor_Last Name"
          },
          "Email":{
              title:"EMAIL",
              className: "min-phone",
              setQstn:"ReqFor_Email"
          },
          "Login Id":{
              title:"LOGIN",
              className: "none",
              setQstn:"ReqFor_Login ID"
          },
          "Work Phone Number":{
              title:"PHONE",
              className: "hidden",
              setQstn:"ReqFor_Phone"
          }
      },
      appendTo: '#requested_for_results',
      resultsContainerId: 'requestedForTable',
      before: function(){
      },
      success: function (){
      },
      success_empty: function(){
          alert("No results Found");
      },
      error: function(){
      },
      complete: function(){
      },
      clickCallback: function(results){
        KD.utils.Action.setQuestionValue('Requested For',results["First Name"]+' '+results["Last Name"]);
      },
  };