QTabPanel Plugin
Mon, 09/21/2009 - 02:52
Hello folks
I just create a plugin of my old implementation of TabPanel see at http://trac.qcu.be/projects/qcubed/browser/plugins/QTabPanel and a little demo at http://maccabi.enzolutions.com/admin/assets/plugins/QTabPanel/example/ta...
I know meestag and marcos have some improvements, but now in plugin and in subversion could be easy to add changes
Regards
enzo

Excellent! Thanks, enzo! I'm looking forward to seeing all those contributions rolled up into the official SVN!
Thank 'u very much Enzo, great work !!!!!
Enzo - I just checked in some code cleanup for the QTabPanel plugin (really minor stuff) + a rewrite of the example text. http://trac.qcu.be/projects/qcubed/changeset/513.
I also added the example of the plugin to the official examples site (http://examples.qcu.be/) and the plugin directory (http://trac.qcu.be/projects/qcubed/wiki/plugins).
Thanks again for your contribution!
Enzo, nice stuff there!
I have my own implementation of jquery tabs. What would be the best thing to do? Should I create another plugin or we could try to merge stuff?
My implementation has (like yours) one wrapper class (QTabsPanel) and class for each tab itself (QTabPanel). Besides naming, I expect developer to extend QTabPanel to write their panels. That way you can build the contents of the tab just like you would with a regular QPanel. For example, you can create template file for the contents to layout stuff.
I also implemented ajax loading for my tabs panel. For example, user has 10 tabs, but each of them needs several database queries etc, it's not always wise to load all the tabs. So, if developer wants, the contents of the tab can be loaded when tab is clicked. Then the contents can be cached (when user clicks again, the contents are not reloaded) or not (for each click, the contents are reloaded).
And one more addition (which I'm not sure works 100% correctly) is that when user opens up the page "index.php#tab2", then the tab named "tab2" will be opened (even when it needs ajax loading by default). This feature is pretty fresh and I haven't tested it widely.
What I'm missing:
1) javascript and css includes (I assume those are loaded manually)
2) validation
3) different kind of customization possibilities
I created this tool for one of my projects. But now I have used in 2-3 sites already. And I only added things I really needed. So, that's why I miss a lot of stuff what really should be there for a plugin.
Somehow I think, it would be wise to have one plugin for tabbing (2-3 different plugins for that may be hard to choose from). But I'm waiting for your opinion or ideas, how to continue.
Hello Agsel
Looks like your implementation has more features, I guess the best approach is to merge and include your enhancements using the same plug-in in SVN: http://trac.qcu.be/projects/qcubed/export/514/plugins/QTabPanel/
About your missing points.
1. Check my CSS and JS includes in my first approach.
2. I don't understand what do you want to validate?
3. Any extend is possible using a class extends I think this points is not a big deal IMHO.
Greetings from Costa Rica, in what country are you?
Regards,
enzo
Hello Enzo and Agsel,
I'm also interested in making only one QTab-Plugin. I have extended the old QCodo QTab patch with showing error-status of a tab (css-class) and disable tabs. Maybe you need this too.
Cheers,
Andreas
I'm from Estonia.
About your question regarding to validation. I don't want to validate anything myself. But I saw you had this feature (basically all the tabs should be validated when validating tabs wrapper).
About extending your tabs. I believe your tab section was based on qblockcontrol. I'm not sure, but I think you cannot add template to it so easily? Or can you? My implementation used QPanel a tab section and when extending, you were able to use template file to render the contents. But yeah, basically it's doable with your version too.
I will try to create a patch with my updates.
Hello,
I have problem with QTabPanel plugin. When I set any QTabPanel property in Pre_Render method, QCubed returns error that Data grid control in QTabPanel has already been rendered when any Ajax Action occurs.
It only happens with DataGrid controls generated by QCubed. Error is: "This control has already been rendered: c4", where c4 is id of data grid in QTabPanel.
I would be very happy if someone could help me solve this.
Here is the shortest code that generates this error.
<?php
class Testera extends QForm {
protected $dtgZaliha;
protected $pnlPanel;
protected $secSection1;
protected $secSection2;
protected $btnButton;
function Form_Run() {
;
}
protected function Form_Create() {
$this->pnlPanel = new QTabPanel($this);
$this->secSection1 = new QTabPanelSection($this->pnlPanel);
$this->secSection1->Title = "helo";
$this->secSection2 = new QTabPanelSection($this->pnlPanel);
$this->secSection2->Title = "helo123";
$this->dtgZaliha = new IdentDataGrid($this->secSection2); // IdentDataGrid is Generated Data grid
$this->dtgZaliha->MetaAddColumn('IdentNaziv'); // some tabel's name
$this->btnButton = new QButton($this);
$this->btnButton->Text = 'Hello';
$this->btnButton->AddAction(new QClickEvent(), new QAjaxAction('someAjaxAction'));
}
protected function someAjaxAction($strFormId, $strControlId, $strParameter) {
QApplication::DisplayAlert('Hello');
}
function Form_PreRender() {
$this->pnlPanel->Visible = true; // When I comment this line, no error occurs
}
}
?>
On tpl page I render button and panel.
Thanks in advanced
irena - could you be so kind and open a ticket in Trac with this issue, please? Set milestone = plugin.
OK, ticked created!
Thanks a lot
Hello Irene
Sorry for the delay, could you enable an online example to test the bug.
Thanks,
enzo
Hello folks
I just did a small update. The change consist in only user method RenderWithName() for object with name, object without name will call the method Render().
This change is useful to enable use object like QDataGrids inside QTabPanel.
Enjoy it.
enzo
Hi,
I had a problem with validation in QTabPanel. After a quite long bug trace, i think i found an error.
The problem is next. Whenever a control in QTabPanel "throws" a validation error (required, min&max length, etc.), exception "This control has already been rendered" occurs.
Here is minimal code that causes this error.
<?php
require('../qcubed.inc.php');
class TestForm extends QForm {
protected $btnSave;
protected $txtTest;
protected $tabPanel;
protected $tabPanelSection1;
protected function Form_Create() {
$this->btnSave_Create();
$this->tabPanel = new QTabPanel($this);
$this->tabPanel->ActiveTab = 0;
$this->tabPanel->Width = 500;
$this->tabPanelSection1 = new QTabPanelSection($this->tabPanel);
$this->tabPanelSection1->Title = 'First tab';
$this->txtTest = new QTextBox($this->tabPanelSection1);
$this->txtTest->Name = 'Input';
$this->txtTest->Required = true;
}
protected function btnSave_Create() {
$this->btnSave = new QButton($this);
$this->btnSave->Text = 'Save';
$this->btnSave->CausesValidation = true;
$this->btnSave->PrimaryButton = true;
$this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
}
}
TestForm::Run('TestForm');
?>
template is even more simple:
<?php $this->RenderBegin() ?>
<div id="formControls">
<?php
$this->tabPanel->Render();
?>
</div>
<div id="formActions">
<?php $this->btnSave->Render(); ?>
</div>
<?php $this->RenderEnd() ?>
So, when ValidateControlAndChildren on QTabPanel runs it finds the validation error in TextBox. After that, it render itself. With that, it render all child controls (text box) as well. And after that, the textbox is called to be render as well, but since its parent (QTabPanelSection) is not marked as rendered, control tries to render itself. And that is where error is.
My soulution was quite simple. I just put
<?php$this->blnRendered = true;
?>
at the end of QTabPanelSection's Render method (before "// Return or Display").
Since then it worked quite smootly (:
dugokontov, thanks so much for reporting the issue! Can you please do us a favor and create a Trac ticket for it? Just go to http://trac.qcu.be/projects/qcubed/report/3, log in using same credentials you use for the forum, and click New Ticket. We'll then be able to integrate your suggestion into the plugin.
Thanks!!
Ticket #406 created.
regards
Случайные афоризмы:
Даже в сказках Елена Премудрая и Елена Прекрасная - разные Фото знаменитостей
Рожденный ползать может Адриана Лима полетами.
Хороших людей, конечно, больше, только они Айшвария Рай реже.
Нет сомнений, что лень может Алсу любые чувства!
Умом ты можешь не блистать, но сапогом блистать Анджелина Джоли
Запретить думать - трудно. Но Энн Хэтэуэй труднее - заставить.
Когда в коридорах власти хлопают Аврил Лавин смотрите, кого прихлопнули!
Я Бритни Спирс этy пpогpаммy с 7 байт!
Деньги, как кислород: мало - Кристина Агилера задыхаешься, много - голова кружится.
Деми Мур враги... Где ж взять такое количество ужина?!
В человеке все Эмма Уотсон быть. (Паталогоанатом)
Крайняя степень одиночества - это когда Джессика Альба себе ставишь клизму.