#order the table by any field you want $tblFriend->addOrderBy("ORDER BY fldName"); #add a button at the bottom of the table which simply goes to another page $tblFriend->addButton("No More Friends. Take Me Home", "./"); //$tblFriend->turnOffSorting(); //turns off ajax sorting by pressing header links //$tblFriend->disableTableHeaders(); //disables table headers from displaying //$tblFriend->turnOffAjaxEditing(); //turns of ajax editing of all data #some logic if we want to add a field automatically on add $state = ""; if (isset($_REQUEST['state'])) { $state = $_REQUEST['state']; } if ($state) { $tblFriend->addWhereClause("WHERE fldState = \"{$state}\""); $tblFriend->omitAddField("fldState"); $tblFriend->addValueOnInsert("fldState", $state); } echo "<h3>Example3 tests FormatFieldWithFunction, defineRelationship, Multiple Filters, and a Date Picker</h3>\n"; $tblFriend->showTable(); echo "<p>Above is a table of my friends. The javascript masking and validation are in the fields 'phone' and 'zip' (required). There's a datapicker on the 'Date we Met' field.</p>\n"; #self-defined functions used for formatFieldWithFunction function addDollarSign($val) { return "\$" . $val; } function displayImage($val) { return "<img src=\"uploads/{$val}\" width=\"90\">"; } function myFunctionAfterAdd($array) {
$tblEventAttendee->omitFieldCompletely("fldIPAddress"); $tblEventAttendee->omitFieldCompletely("fkEventID"); $tblEventAttendee->omitFieldCompletely("fldPhone"); $tblEventAttendee->omitFieldCompletely("fldAttending"); $tblEventAttendee->validateDeleteWithFunction("canRowBeModifiedOrDeleted"); $tblEventAttendee->validateUpdateWithFunction("canRowBeModifiedOrDeleted"); $tblEventAttendee->defineCheckbox("fldWillBeLate"); $tblEventAttendee->addOrderBy("ORDER BY fldFirstName ASC"); #Add WHERE clause so we only display information specific to the event that was selected $tblEventAttendee->addWhereClause("WHERE fkEventID = {$eventID}"); #I could add filter boxes to the top, but have chosen not to do so; commenting these out //$tblEventAttendee->addAjaxFilterBox("fldFirstName"); //$tblEventAttendee->addAjaxFilterBox("fldLastName"); //$tblEventAttendee->addAjaxFilterBox("fldAttending"); //using addValueOnInsert so when someone signs up it will automatically add them to this event $tblEventAttendee->addValueOnInsert("fkEventID", $eventID); //using addValueOnInsert to track their IP address $tblEventAttendee->addValueOnInsert("fldIPAddress", $_SERVER["REMOTE_ADDR"]); $tblEventAttendee->setTextboxWidth("fldTimeArriving", 8); $tblEventAttendee->setTextboxWidth("fldLastName", 25); $tblEventAttendee->setTextareaHeight("fldComments", 70); //comment field should be a bit wider height #set the number of rows to display (per page) $tblEventAttendee->setLimit(25); //after 25 people, the resultset will paginate $tblEventAttendee->setAddPlaceholderText("fldTimeArriving", $fldTime); $tblEventAttendee->setAddFieldNote("fldTimeArriving", "Leave blank if you'll be on time."); $tblEventAttendee->setAddFieldNote("fldWillBeLate", "If you will be arriving late, please enter the time in the next box."); $tblEventAttendee->modifyFieldWithClass("fldTimeArriving", "time"); $tblEventAttendee->modifyFieldWithClass("fldLastName", "required"); $tblEventAttendee->modifyFieldWithClass("fldFirstName", "required");