コード例 #1
0
ファイル: example3.php プロジェクト: swanescalona/ajaxcrud
$tblFriend->displayAs("fldBestFriend", "Best Friend?");
$tblFriend->displayAs("fldDateMet", "Date We Met");
$tblFriend->displayAs("fldFriendRating", "Rating");
$tblFriend->displayAs("fldOwes", "Owes Me How Much?");
$tblFriend->displayAs("fldPicture", "Image");
$tblFriend->displayAs("fkMarriedTo", "Married To");
#disallow new friends to be added (removes the add button)
//$tblFriend->disallowAdd();
#use if you only want to show a few of the fields (not all)
//$tblFriend->showOnly("fldName, fldAddress, fldState, fldOwes");
#use if you want to rearrange the order your fields display (different from table schema)
//$tblFriend->orderFields("pkFriendID, fldAddress, fldName, fldState");
#set the number of rows to display (per page)
$tblFriend->setLimit(2);
#set a filter box at the top of the table
$tblFriend->addAjaxFilterBox('fldName', 20);
$tblFriend->addAjaxFilterBox('fldDateMet');
$tblFriend->addAjaxFilterBox('fkMarriedTo');
#allow picture to be a file upload
$tblFriend->setFileUpload('fldPicture', 'uploads/', 'uploads/');
//$tblFriend->disallowEdit("fldPicture");
$tblFriend->onAddExecuteCallBackFunction("myFunctionAfterAdd");
#format field output
$tblFriend->formatFieldWithFunction('fldOwes', 'addDollarSign');
$tblFriend->formatFieldWithFunction('fldPicture', 'displayImage');
$tblFriend->defineCheckbox("fldBestFriend", "Y", "N");
#modify field with class
$tblFriend->modifyFieldWithClass("fldDateMet", "datepicker");
$tblFriend->modifyFieldWithClass("fldZip", "zip required");
$tblFriend->modifyFieldWithClass("fldPhone", "phone required");
$tblFriend->modifyFieldWithClass("fldEmail", "email");
コード例 #2
0
ファイル: example2.php プロジェクト: swanescalona/ajaxcrud
$tblDemo->defineCheckbox("fldCheckbox", "1", "0");
$tblDemo->setLimit(5);
$tblDemo->addAjaxFilterBox('fldField1');
$tblDemo->formatFieldWithFunction('fldField1', 'makeBlue');
$tblDemo->formatFieldWithFunction('fldField2', 'makeBold');
echo "<h2>Table tblDemo</h2>\n";
$tblDemo->showTable();
echo "<br /><hr ><br />\n";
$tblDemo2 = new ajaxCRUD("Item", "tblDemo2", "pkID");
$tblDemo2->omitPrimaryKey();
$tblDemo2->displayAs("fldField1", "Field1");
$tblDemo2->displayAs("fldField2", "Field2");
$tblDemo2->displayAs("fldCertainFields", "Color");
$tblDemo2->displayAs("fldLongField", "Long Field");
$allowableValues2 = array("Green", "Blue", "Red", "Periwinkle");
$tblDemo2->defineAllowableValues("fldCertainFields", $allowableValues2);
$tblDemo2->setTextareaHeight('fldLongField', 50);
$tblDemo2->setLimit(20);
$tblDemo2->addAjaxFilterBox('fldField1');
$tblDemo2->formatFieldWithFunction('fldField2', 'makeBlue');
$tblDemo2->formatFieldWithFunction('fldField1', 'makeBold');
echo "<h2>Table tblDemo2</h2>\n";
$tblDemo2->showTable();
function makeBold($val)
{
    return "<b>{$val}</b>";
}
function makeBlue($val)
{
    return "<span style='color: blue;'>{$val}</span>";
}