QPanel
Add QJavaScriptAction to datagrid in QPanel
I'm having a problem adding a QJavaScriptAction to a datagrid control, which is created inside a QPanel. I'm using QCubed 2.0.1
The control is created like this:
$this->dtgOpLines->AddColumn(new QDataGridColumn('Lot Chg', '<?= $_CONTROL->ParentControl->chkLotChg_Render($_ITEM) ?>','HtmlEntities=false'));And, here's the code, where the control is created:
public function chkLotChg_Render(Priceworkorderdets $objOpCodeArray) {
$strControlId = 'LotChg' . $objOpCodeArray->Id;
$LotChg = $this->objForm->GetControl($strControlId);
if (!$LotChg) {
$LotChg = new QTextBox($this->dtgOpLines, $strControlId);
$LotChg->AddAction(new QKeyUpEvent(), new QJavaScriptAction('return numdecs(this,event)'));
$LotChg->Text = number_format($objOpCodeArray->LotChg,2);
$LotChg->AddCssClass("priceprice");
$LotChg->ActionParameter = $objOpCodeArray->Id;
}
return $LotChg->Render(false);
}The problem is, the Javascript is not being executed. If I move code for creating the control to the parent (QForm), it works. Obviously, there's something wrong with the AddAction. Any help will be very much appreciated.
Thanks!
QPanel child(s) validation error message
Hi folks!
I have few a question about child controls inside a QPanel. For an example here is some code (I just extendend the provided sample.php):
<?php
// Include prepend.inc to load Qcodo
require('includes/configuration/prepend.inc.php');
class SampleForm extends QForm {
protected $lblMessage;
protected $btnButton;
protected $pnlControls;
protected $btnSave;
protected function Form_Create() {
$this->lblMessage = new QLabel($this);
$this->lblMessage->Text = 'Click the button to change my message.';
$this->btnButton = new QButton($this);
$this->btnButton->Text = 'Click Me';
$this->btnButton->AddAction(new QClickEvent(), new QServerAction('btnButton_Click'));
$this->btnSave = new QButton($this);
$this->btnSave->Text = 'save';
$this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
$this->btnSave->CausesValidation = true;
$this->pnlControls = new QPanel($this);
$this->pnlControls->AutoRenderChildren = true;
for ($i=0; $i < 4; $i++) {
$label = new QLabel($this->pnlControls);
$txtBox = new QTextBox($this->pnlControls);
$txtBox->ActionParameter = $i;
$txtBox->ValidateTrimmed = true;
$txtBox->Required = true;
$txtBox->Name = 'Name'.$i;
$label->Text = "Field".$i;
}
}
protected function Form_Validate() {return true;}
protected function btnSave_Click() {
QApplication::DisplayAlert('save');
}
protected function btnButton_Click($strFormId, $strControlId, $strParameter) {
$this->lblMessage->Text = 'Hello, World!';
}
}
SampleForm::Run('SampleForm');
?>Template:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php _p(QApplication::$EncodingType); ?>" />
<title>Sample QForm</title>
<style type="text/css">@import url("<?php _p(__VIRTUAL_DIRECTORY__ . __CSS_ASSETS__); ?>/styles.css");</style>
</head><body>
<?php $this->RenderBegin(); ?>
<p><?php $this->lblMessage->Render(); ?></p>
<p><?php $this->btnButton->Render(); ?></p>
<p><?php $this->pnlControls->RenderWithError(); ?></p>
<p><?php $this->btnSave->Render(); ?></p>
<?php $this->RenderEnd(); ?>
</body></html>So, it's basically dynamically creating QTextBox controls which are childs of a QPanel. As you see there are also a QLabel controls, which are used instead QTextBox->Name. Is possible to render QTextBox created like that (dynamically) to get a result as RenderWithName (to render controls' QTextBox->Name)?
Second question would be about validation error message. Validation goes through, if the QTextBox fields are empty the method btnSave_Click() isn't called, but there isn't any error message provided (field xyz is required).
edit inline
Hi!
I have a question about 'edit inline' with a DataGrid. I have a page with a DataGrid with clients of my DB, when click in any row, you see a qpanel, in this qpanel I do twice Datagrid more with more information about my client. My questions is that is possible edit inline these others Datagrids inside the qpnel. I don't know if I've explained as well like I want, sorry, amb new in qcubed and my english is a little poor
thanks
Nested QPanel Callback Method
I have a form which has QPanel A. QPanel A has 2 QPanels, B & C. QPanels B & C use a Callback Method to QPanel A. The actual Callback function is defined on QPanel A, NOT on the Form.
How do I make the call on QPanel A? I tried using $this->objParentControl->$strCallbackMethod instead of $this->objForm->$strCallbackMethod but that doesn't seem to be working.
I had this all working before introducing the nested QPanels. When Panels B & C were being created directly on the form, it worked. The call to the callback method just isn't working and no error is being generated either.
Please help : <
New Plugin: QProfEmailTemplater
Hello All,
Before I proceed please how do I get (automatically) the full URL to pages in my application e.g. http://localshop/myapp/page1.php
If I can at least get the "http://localshop" part alone, I can finish the job. Please help.
Now to the main thing:
Please I just finished a plugin I used for one of my projects. I call it QProfEmailTemplater. It works like the email component in CakePHP, allowing you to specify HTML and Text Template files with placeholder variables that gets replaced before the email is actually sent. This plugin does the replacing and then returns the TEXT or HTML string for use with QEmailMessage and QEmailServer. A sample is also ready.
I believe we all know about what I'm talking about. Please can you tell me how to publish my plugin for sharing, correction and further development? Thank you.
How to use HtmlBefore and HtmlAfter
this->test = new QLabel($this);
$this->test->Text = ' TEST ';
$this->test->HtmlBefore = '<table width=100% bgcolor="#000000" cellpadding="1" cellspacing="1"><tr bgcolor="#FFFFFF" ><td width=100% align="left" valign="top"> ';
$this->test->HtmlAfter = '</td></tr></table>';But it doesn`t work...
I want to take comments from db, add them to QPanel and display them inside separate tables.
Pls tell me, that how can this be done?
How to remove objects from QPanel?
$txtTextbox = new QTextBox($this->pnlPanel3);
$txtTextbox->Text = sprintf($rida . '', $intIndex);How can I clear all objects from pnlPanel3?
Passing QDataGrid Data to a method or function
Good Day Qcubers,
Please I have a datagrid rendered in a QPanel just like its done in the auto-generated dashboard. Now the task is that I wish to forward the displayed data (filtered by date) to an email list.
The problem I have right now is how to make the displayed data in the datagrid control available in the function for sending the email. I would appreciate any help on this please.
Thanks as usual!
QPanel AfterRender() Method Available?
Please I need to execute a method after my panel has been successfully rendered but before my form exits. Is there a QPanel AfterRender Method? How do I go about this please.
--
@Tribute: R.I.P M.J.
Life cycle of a QPanel PLEASE
Its like, everyone is no longer interested in developing qcubed anymore! Why, I am not getting replies to my pleas for help anymore?
I asked for help on redirection using HTACCESS in a previous topic I posted but nothing came up.
Please this one is on my neck and a lifetime depends upon it! Please, I know that a form has a lifecycle that goes thus: Form Run, Form Create/Form Load, Form........ Form Exit etc. Please what is the equivalent for a QPanel.
