当前位置: 首页>>代码示例>>PHP>>正文


PHP DataGrid::AddColumnSelectkey方法代码示例

本文整理汇总了PHP中DataGrid::AddColumnSelectkey方法的典型用法代码示例。如果您正苦于以下问题:PHP DataGrid::AddColumnSelectkey方法的具体用法?PHP DataGrid::AddColumnSelectkey怎么用?PHP DataGrid::AddColumnSelectkey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataGrid的用法示例。


在下文中一共展示了DataGrid::AddColumnSelectkey方法的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;
}
开发者ID:billyriantono,项目名称:ihrmis,代码行数:64,代码来源:example.php


注:本文中的DataGrid::AddColumnSelectkey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。