QTabPanel Plugin

Login or register to post comments
16 replies [Last post]
enzo's picture
Offline
Joined: 03/31/2008

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

alex94040's picture
Offline
Joined: 11/06/2008

Excellent! Thanks, enzo! I'm looking forward to seeing all those contributions rolled up into the official SVN!

Offline
Joined: 07/08/2008

Thank 'u very much Enzo, great work !!!!!

alex94040's picture
Offline
Joined: 11/06/2008

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!

agsel's picture
Offline
Joined: 04/02/2008

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.

enzo's picture
Offline
Joined: 03/31/2008

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

akrohn's picture
Offline
Joined: 11/14/2008

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

agsel's picture
Offline
Joined: 04/02/2008

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.

Offline
Joined: 11/17/2009

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

alex94040's picture
Offline
Joined: 11/06/2008

irena - could you be so kind and open a ticket in Trac with this issue, please? Set milestone = plugin.

Offline
Joined: 11/17/2009

OK, ticked created!

Thanks a lot

enzo's picture
Offline
Joined: 03/31/2008

Hello Irene

Sorry for the delay, could you enable an online example to test the bug.

Thanks,

enzo

enzo's picture
Offline
Joined: 03/31/2008

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

Offline
Joined: 09/11/2009

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 (:

alex94040's picture
Offline
Joined: 11/06/2008

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!!

Offline
Joined: 09/11/2009

Ticket #406 created.

regards

tyc4000 (not verified)

Случайные афоризмы:
Даже в сказках Елена Премудрая и Елена Прекрасная - разные Фото знаменитостей
Рожденный ползать может Адриана Лима полетами.
Хороших людей, конечно, больше, только они Айшвария Рай реже.
Нет сомнений, что лень может Алсу любые чувства!
Умом ты можешь не блистать, но сапогом блистать Анджелина Джоли
Запретить думать - трудно. Но Энн Хэтэуэй труднее - заставить.
Когда в коридорах власти хлопают Аврил Лавин смотрите, кого прихлопнули!
Я Бритни Спирс этy пpогpаммy с 7 байт!
Деньги, как кислород: мало - Кристина Агилера задыхаешься, много - голова кружится.
Деми Мур враги... Где ж взять такое количество ужина?!
В человеке все Эмма Уотсон быть. (Паталогоанатом)
Крайняя степень одиночества - это когда Джессика Альба себе ставишь клизму.