我的目标是创建一个 dGrid,其中每一列都有一个标签和一个名为评论的标签旁边的按钮。
仅当 slot_header != "" 时,否则我们将所有列隐藏在一起。当我通过它时,我有隐藏工作“”。就在我通过 header = "HELLO" 时,列的标签变为:
“HELLO[Widget dijit.form.Button, dijit_form_Button_19]” 目标是“HELLO”CLICKABLEBUTTON
我正在使用 PHP 来实例化网格,然后在 renderCell 中使用 lang.hitch 来构建进入 domNode 的内容,任何帮助将不胜感激
$singleStudentDetail = array(
array('field' => 'line_nbr', 'label' =>'Line', 'properties' => array('width' => $width)),
array('field' => 'skill_desc', 'label' =>'Skill', 'properties' => array('width' => $width)),
array('field' => 'display_slot_01', 'label' => 'Notes',
'properties' => array('width' => 55, 'sortable' => 'false', 'renderCell' =>
'lang.hitch(this,function(object,value,node,options){
node.innerHTML = object["grades_01"];
var myButton = new Button({
label: "Click me!",
onClick: function(){
// Do something:
alert("THIS BUTTON WORKED");
}
});
if(object["slot_headings_01"] != "")
{
studentListDetailDGridVar.columns[3].label = object["slot_headings_01"] + myButton
}
else
studentListDetailDGridVar.columns[3].hidden = true;
})'
)
));
$DgridParamsDetail = array(
"columns" => $singleStudentDetail,
"gridVar" => "studentListDetailDGridVar",
"gridDiv" => "studentListDetailDiv",
"gridProperties" => array("rowsPerPage" => 15),
"render" => true
);