protected function Form_Create() { // Define the DataGrid $this->dtgPersons = new QHtmlTable($this); // Define Columns // This first example uses a callback to draw the column, which is the most versatile way of drawing a column. // In other examples, we will describe other column types that let you draw some standard column types. $col = $this->dtgPersons->CreateCallableColumn('First Name', [$this, 'dtgPerson_FirstName_Render']); $col->CellStyler->Width = 200; // style for the 'td' tag of the column $col = $this->dtgPersons->CreateCallableColumn('Last Name', [$this, 'dtgPerson_LastName_Render']); $col->CellStyler->FontBold = true; // style for the 'td' tag of the column // Specify the local Method which will actually bind the data source to the datagrid. // In order to not over-bloat the form state, the datagrid will use the data source only when rendering itself, // and then it will proceed to remove the data source from memory. Because of this, you will need to define // a "data binding" method which will set the datagrid's data source. You specify the name of the method // here. The framework will be responsible for calling your data binding method whenever the datagrid wants // to render itself. $this->dtgPersons->SetDataBinder('dtgPersons_Bind'); // Update the styles of all the rows, or for just specific rows // (e.g. you can specify a specific style for the header row or for alternating rows) // Note that styles are hierarchical and inherit from each other. For example, the default RowStyle // sets the FontSize as 12px, and because that attribute is not overridden in AlternateRowStyle // or HeaderRowStyle, both those styles will use the 12px Font Size. // While there are a variety of ways to style tables QCubed, the easiest and most versatile is to use css // classes. These are defined at the top of the intro.tpl.php file in this example. $this->dtgPersons->HeaderRowCssClass = 'header-row'; $this->dtgPersons->RowCssClass = 'row'; $this->dtgPersons->AlternateRowCssClass = 'alt-row'; }
protected function Form_Create() { $this->dtg = new QHtmlTable($this); $this->dtg->SetDataBinder('BindData'); $col = $this->dtg->CreateCallableColumn('Link', [$this, 'dtg_LinkRender']); $col->HtmlEntities = false; $col = $this->dtg->CreateCallableColumn('Button', [$this, 'dtg_ButtonRender']); $col->HtmlEntities = false; $this->lblVars = new QLabel($this); }
protected function Form_Create() { // Define the DataGrid $this->tblProjects = new QHtmlTable($this); // This css class is used to style alternate rows and the header, all in css $this->tblProjects->CssClass = 'simple_table'; // Define Columns // Show the name of the project $this->tblProjects->CreateNodeColumn('Project', QQN::Project()->Name); // Date column formatting. Uses the Format string to format the date object that is in the column. $col = $this->tblProjects->CreateNodeColumn('Start Date', QQN::Project()->StartDate); $col->Format = 'MM/DD/YY'; $col = $this->tblProjects->CreateNodeColumn('End Date', QQN::Project()->EndDate); $col->Format = 'DDD, MMM D, YYYY'; // PersonAsTeamMemberArray is an array of names. Use a callback to format the array into a string. $col = $this->tblProjects->CreatePropertyColumn('Members', 'PersonAsTeamMemberArray'); $col->PostCallback = 'ExampleForm::RenderTeamMemberArray'; // $col = $this->tblProjects->CreateCallableColumn('Balance', [$this, 'dtgPerson_BalanceRender']); $col->CellParamsCallback = [$this, 'dtgPerson_BalanceAttributes']; $this->tblProjects->SetDataBinder('tblProjects_Bind'); }