本文整理匯總了PHP中DataGrid::AddColumnSelect方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataGrid::AddColumnSelect方法的具體用法?PHP DataGrid::AddColumnSelect怎麽用?PHP DataGrid::AddColumnSelect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataGrid
的用法示例。
在下文中一共展示了DataGrid::AddColumnSelect方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: BuildTable
function BuildTable($cls, $pos = 1, $sortcol = '', $sortdesc = 0)
{
$pospage = 8;
global $data_file;
//the display properties for the odd and even rows
$odd = array('style' => 'background-color: #CCCCCC;');
$even = array('style' => 'background-color: #EEEEEE;');
//the display properties for the overall table
$table = array('cellpadding' => '3', 'cellspacing' => '0');
//table column header formatting properties
$headerattrib = array('style' => 'background-color: skyblue; cursor:pointer;');
$data = file_get_contents($data_file);
$data = unserialize($data);
//sort
if ($sortcol) {
// Obtain a list of columns
foreach ($data as $key => $row) {
$sort1[$key] = $row[$sortcol];
$data[$key]['key'] = $key;
}
// Sort the data
if ($sortdesc) {
array_multisort($sort1, SORT_DESC, $data);
} else {
array_multisort($sort1, SORT_ASC, $data);
}
}
//filter rows
$pos--;
//zero based position
if ($pos < 0) {
$pos = 0;
}
$poscnt = count($data);
if ($pos >= $poscnt) {
$pos = floor(($poscnt - 1) / $pospage) * $pospage;
}
$r = 0;
foreach ($data as $k => $v) {
if ($r < $pos || $r >= $pos + $pospage) {
unset($data[$k]);
}
$r++;
}
require_once "./AjaxDataGrid.class.php";
$at = new DataGrid($data, "");
$at->JsClass = $cls;
$at->pos = $pos + 1;
//one based position
$at->pospage = $pospage;
$at->poscnt = $poscnt;
$at->SetEvenRowAttribs($even);
$at->SetOddRowAttribs($odd);
$at->SetTableAttribs($table);
$at->SetHeaderAttribs($headerattrib);
$at->AddColumnReadonly("id", "id[Readonly]");
$at->AddColumnHidden("col1", "col1[Hidden]");
$at->AddColumnText("col2", "col2[Text]");
$at->AddColumnSelect("col3", "col3[Select]", array("1st option", "2nd option", "test ' qoute", "test \" dqoute", "test < lt", "test & amp"));
$at->AddColumnSelectkey("col4", "col4[Selectkey]", array("key1" => "1st option", "key2" => "2nd option", "key3" => "test ' qoute", "key4" => "test \" dqoute", "key5" => "test < lt", "key6" => "test & amp"));
$at->AddColumnCheckbox("col5", "col5[Checkbox]");
$at->AddColumnTextarea("col6", "col6[Textarea]", 200, 100);
return $at;
}