Dynamic SPDisplayRelatedInfo

Feb 1, 2011 at 5:07 PM

Marc

I'm trying to change the list and columns that are displayed in SPDisplayRelatedInfo based on which radio button is selected by the user. What I'm finding is that whatever the second selection is, the columns and information are not displaying.  Using $('#SPDisplayRelatedInfo_').hide(); worked as far as removing the columns and information from the first selection (radio button) but the columns and information from the second selection (radio button) never displayed. Can you point me in the right direction as to how to ensure that the SPDisplayRelatedInfo area is refreshed based on the selection?

I am using SPAutocomplete along with SPDisplayRelatedInfo but it is working as expected.

$('#SPAutocomplete_container').click(function(){
 
   var listName, relListColumn;
   
     if( $('#MasterNameRadio:checked').val() !== undefined){
  
   var relListColumns  =["Name","Address","Date_x0020_of_x0020_Birth","Officer_x0020_Safety"];
   relListColumn   ='Name';
   listName  ='MasterName';

  }
  
  if( $('#CaseRadio:checked').val() !== undefined){
  
   var relListColumns =["Case_x0020_Number","Offense_x0020_Classification","Date","Case_x0020_Status"];
   relListColumn   ='Case_x0020_Number';
   listName  ='Cases';

  }
  
  $('#SPDisplayRelatedInfo_').hide();
  $().SPServices.SPDisplayRelatedInfo({ 
    columnName: "Case Number",
    relatedWebURL: "",
    relatedList: listName,
    relatedListColumn: relListColumn,
    relatedColumns: relListColumns,
    displayFormat: "table",
    headerCSSClass: "ms-vh2",
    rowCSSClass: "ms-vb",
    numChars: 1,
    matchType: "Eq",
    CAMLQuery: "",
    debug: true,
    completefunc: null
   });
 });// End SPAutoComplete

 

Thanks

Marcus

Coordinator
Feb 1, 2011 at 6:29 PM
Marcus: I wrote SPDisplayRelatedInfo to work with dropdowns, not radio buttons, so I'm surprised it works for you at all! Obviously you can clone the code and customize it to work with radio buttons as well, but that's a task you'll need to undertake. M.
Feb 1, 2011 at 9:47 PM

Marc

My apologies for the confusion. The field that SPDisplayRelatedInfo is based off of is a normal input field. The value that is displayed in the input field change according to what is selected by the radio button. Hence SPDisplayRelatedInfo needs to change. Does that clarify?

Coordinator
Feb 2, 2011 at 2:01 AM

Marcus:

I'm still not getting what you're up to. Can you post a screenshot somewhere?

M.