ajaxCRUD.com

» a PHP class to Create, Read, Update, & Delete from a mysql database table using AJAX

   by loud canvas media

AjaxCRUD Class Documentation / Reference Material

Object: ajaxCRUD

Constructor

Name Requires Returns Default Short description Example
ajaxCRUD object constructor for instantiating the class
new ajaxCrud ( String buttonText, String dbTableName, String dbPrimaryKey, [ String ajaxcrudDir = ""] ) More...
Example

Functions

Name Requires Returns Default Short description Example
addAjaxFilterBox void adds a search box at the top of the page More... Example
addAjaxFilterBoxAllFields all fields searchable adds searchboxes for all fields in your table More... Example
addButton void adds a button to the bottom of the page More... Example
addButtonToRow void no button adds a button to every row and sends the id (pk) of that item to any url More... Example
addOrderBy void orders the table by a specified field More... Example
addTableBorder void off adds a border to the html table
this function is deprecated! -- please use setCSSFile to control style/layout
More...
Example
addValueOnInsert void sets a value to a field on row insert More... Example
addWhereClause void null adds a SQL "where clause" to the query More... Example
appendUploadFilename setFileUpload no value appended append the value of the row to the beginning of the filename More... Example
defineAllowableValues void define "allowable" values for a field. More... Example
defineCheckbox void 1,0 Sets the field to be of type 'checkbox'. More... Example
defineRelationship void defines a relationship between your table and another (via the foreign key) More... Example
disableTableHeaders void table headers: true Turns off html table headers for the table More... Example
disallowAdd void disallow new rows to be added to the table More... Example
disallowDelete void disallows row deletion More... Example
disallowEdit void disallows a field to be edited More... Example
displayAddFormTop void bring the Add Row form to the top of the page More... Example
displayAs void actual field name displays the field name in the table under a pseudonym More... Example
formatFieldWithFunction a user-defined function to be set formatted data non-formatted data format data in a column with a custom function More... Example
formatFieldWithFunctionAdvanced a user-defined function to be set formatted data non-formatted data format data in a column with a custom function More... Example
getNumRows int Returns the number of rows returned More... Example
insertRowsReturned dynamic span w/row count 0 Displays the number of rows returned (can be put anywhere in your application view). More... Example
modifyFieldWithClass void add a css class to a field (used for things like jquery validation or field masking) More... Example
omitAddField void omits the input field from displaying when adding a row More... Example
omitField void omits a field from displaying in the table More... Example
omitFieldCompletely void field not omitted this function calls both omitField and omitAddField for a field More... Example
omitPrimaryKey void omits the primary key from displaying in the table More... Example
onAddExecuteCallBackFunction (callback function) void calls a local function when a new row is added More... Example
onDeleteFileExecuteCallBackFunction setFileUpload, (callback function) void calls a local function when a file (that was previously uploaded) is deleted More... Example
onFileUploadExecuteCallBackFunction setFileUpload, your callback function void calls a local function when a file is uploaded More... Example
onUpdateExecuteCallBackFunction (callback function) void calls a local, user-defined php function after a particular field is edited/updated More... Example
orderFields re-sorted fields in table order in database schema sort the fields order in the database More... Example
setAddFieldNote void null Puts a note (description of the field) next to it when adding a column More... Example
setAddPlaceholderText null null Puts placeholder text on the input fields More... Example
setAjaxFilterBoxSize addAjaxFilterBox or addAjaxFilterBoxAllFields 10 **THIS FUNCTION IS DEPRECATED AS OF V6.0; use second (optional) param of addAjaxFilterBox instead**

sets the size (lengh of the textbox) of an ajax filter box More...
Example
setCSSFile void default.css Sets a css file as the stylesheet to be used to render the table. More... Example
setExactSearchField void Table filter assist function; sets a field to use an EXACT search. More... Example
setFileUpload web-safe filename of uploaded file (on upload allows a field to accept file uploads More... Example
setInitialAddFieldValue null null Set the initial value for a field (when adding a row) Example
setLimit void 50 set the limit of number of rows to display More... Example
setOrientation void horizontal set the orientation of the table (i.e. set to veritcal) More... Example
setTextareaHeight void input box Sets the textarea height for a field More... Example
setTextboxWidth void 20 Sets the width size for a textbox field More... Example
showCheckboxAll void Set ALL checkboxes for a field (in a column) to be on of off. More... Example
showCSVExportOption void Displays a button which outputs table to CSV format More... Example
showOnly void all fields show only a few fields from your table instead of all of them More... Example
showTable ajaxCRUD (the constructor) void (displays the table) function to "run" the script / display the table More... Example
turnOffAjaxADD void (ajax used for adding a row) Turns off ajax for the CREATE crud operation (adding a row). More... Example
turnOffAjaxEditing void turns off the ability to edit ALL fields. More... Example
turnOffPaging void paging at 50/page turn off paging so total rows returns maxes at a value More... Example
turnOffSorting void sorting: on Turns off the ability to sort table by clicking the header titles More... Example
validateDeleteWithFunction a user-defined function to be set user-defined method returns true or false Allows you to set logic allowing if deletion of certain rows is permissible or not More... Example
validateUpdateWithFunction a user-defined function to be set user-defined method returns true or false Allows you to set logic allowing if updating a row is permissible or not More... Example

Variables

Name Requires Type Default Short description Example
actionText variable Action Change the text 'Action' that appears in the table header Example
addButtonText variable Add {Item} Overwrites the text of the Add button More... Example
addButtonToRowWindowOpen variable same When a button is added to row (addButtonToRow) the window in which to open page (ALL buttons). More... Example
addMessage variable {Item} added The message that displays after you add a new item (and you're not using ajax adding) More... Example
addText variable Add The word that displays in the button for adding a new row Example
ajaxcrud_where_clause session_start(); variable Most recent/active sql WHERE clause used by the ajaxcrud table. More... Example
cancelText variable Cancel The word that displays in the button for Cancelling out of an add form (slides the form up) Example
cellspacing variable 0 cellspacing for the html table that displays the database table Example
css variable true set to false if you don't want to use a css stylesheet More...
deleteText variable Delete The word that displays in the button for deleting an existing row Example
doActionOnShowTable variable true when set to true CRUD actions will happen when showTable() is called More... Example
emptyTableMessage variable The message that appears when a table is empty. Example
fileDeleteText variable del Change the word that displays for the link that handles file deletions. Example
fileEditText variable edit Change the word that displays for the link that handles file updates. Example
hover_color variable #B1CFF5 (a light blue) color when you hover over a cell to change its value More... Example
showCheckbox variable false puts a checkbox in front of each row More... Example
New

 

"Very interesting class. Thanks a lot."
~gustavo

What is a business/commercial website?

A commercial website is one created for a business, for which purpose is generating revenue or cash flow of any type (and that isn't under a non-profit organization). So if you're selling a product, selling advertisement, selling a service, or just marketing a commercial business, your site is commercial. A company website is also commercial even if it doesn't sell anything, as it's purpose is to front a commercial company.
Close