ajaxCRUD.com
» a PHP class to Create, Read, Update, & Delete from a mysql database table using AJAX
by loud canvas mediaAjaxCRUD 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 searchboxs 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
|
Example | |
| addValueOnInsert | void | sets a value to a field on row insert More... | Example | ||
| addWhereClause | void | null | adds an 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 | ||
| 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 a field name in the table under a psudoname. More... | Example | |
| formatFieldWithFunction | formatted data | non-formated data | format data in a column with a custom function More... | Example | |
| formatFieldWithFunctionAdvanced | formatted data | non-formated 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 | Echos the number of rows returned (can be put anywhere in your application view). More... | Example | |
| modifyFieldWithClass | 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 | field not omited | 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 | |
| orderFields | re-sorted fields in table | order in database schema | sort the fields order in the database More... | Example | |
| setAddFieldNote | 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 | |
| showCheckboxAll | void | Set ALL checkboxes for a field (in a column) to be on of off. More... | Example | ||
| showCSVExportOption | Displays a button which outputs table to CSV format More... | Example | |||
| showOnly | 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 | paging at 50/page | turn off paging so total rows returns maxes at a value More... | Example | ||
Variables | |||||
| Name | Requires | Type | Default | Short description | Example |
| addButtonToRowWindowOpen | variable | new | When a button is added to row (addButtonToRow) the window to open page in More... | 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... | ||
| emptyTableMessage | variable | The message that appears when a table is empty. | 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 | |
"Sweet!!! One of the few packages that runs right out of the box. Just modify a couple of lines[s] [and] it runs perfectly."
~Mike
