AJAX - Function - Table
Contents
1 Primary Function
Without the need to go to another form, this function allows a table of data to be drawn on the current page using specified limiting factors.
For example you have a company and you want to list all the contacts associated with the company. Using the current company id, only contacts associated with that company are displayed.
2 Example uses
- Contacts list for contact management.
- Ticket list for a support desk. Tickets by customer
- Orders by customer
- Products by Invoice
3 Code
/******************************************************************************************************
Application: This function ............
Version [1.0] Date [2016-08-29] Author [PJ]
******************************************************************************************************/
function fn_FunctionName(){
if (typeof aryAjax_Settings=='undefined') { alert('Library did not load'); }
else {
// Clear all settings
fn_Ajax_bxp_ResetSettings();
// Security Settings
aryAjax_Settings[0] = 'client_demo';
aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value; //Auto Login - System
aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value; //Auto Login - User
aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value; //Auto Login - SessionId
// Retrieval Settings
aryAjax_Settings[16] = 'Table'; //Engine to use
aryAjax_Settings[3] = 1; //The form with the data
aryAjax_Settings[4] = 'strCDA_1_field_0_0'; //The field to search on
aryAjax_Settings[5] = document.getElementById('intCDA_Id').value; //The value to limit by
aryAjax_Settings[13] = '-1' //Limit response
aryAjax_Settings[40] = "500"; //Retrieval limit if applicable
//Error management
aryAjax_Settings[15] = 'divWarning'; //Where to draw error messages if any
//Common Functional settings
aryAjax_Settings[6] = 'intCDA_1_Id,strCDA_1_field_0_1'; //The fields to be displayed in the table
aryAjax_Settings[12] = 'Id,Column1'; //The column headings for the fields being displayed
aryAjax_Settings[28] = ''; //Function to be executed after retrieval
//Function specific settings
//...
//Execute
fn_Ajax_BE_Process(); //The main execution of the AJAX
//Write URL out (Comment out after testing)
if (document.getElementById('divURL')){
document.getElementById('divURL').innerHTML = "<a href='" + aryAjax_Settings[7] + "' target='_blank'>Constructed AJAX URL</a>";
}
}
}
4 Troubleshooting
For any errors messages and troubleshooting AJAX please read here AJAX_-_Error_messages_and_troubleshooting
5 Associated reading
For all our custom AJAX functions please read here AJAX_-_Start_Here
For the full array of all possible parameters please read here AJAX_-_Full_Array_of_Parameters
For how the security engine of AJAX works AJAX_-_Security_engine
For more advanced table settings and options have a look at LiveSearchTable AJAX_-_Function_-_Live_Search_Table