Problem with QDialogBox in datagrid

thread: 4 messages  |  last: a year ago  |  started: friday, april 2, 2010, 2:43 pm pdt


#1  |  Mattia Bagiella (Switzerland) Switzerland
Friday, April 2, 2010, 2:43 PM PDT

Hello guys,

I try to put a dialog box in my datagrid but I have an Ajax Error, not an object :( trying to figure out this code

   public function dtgConte_motif_Render($intConteId) {
       $objSuppressionMotifArray = Suppression::LoadArrayByConteId($intConteId);
       if($objSuppressionMotifArray){
           $objSupressionMotif = $objSuppressionMotifArray[0];
           $strControlId = 'Dialog' . $intConteId;
           $this->dlgSimpleMessage = $this->GetControl($strControlId);
           if (!$this->dlgSimpleMessage) {

               $this->dlgSimpleMessage = new QDialogBox($this->dtgConte,$strControlId);
               $this->dlgSimpleMessage->Text = $objSupressionMotif->Motif;
               // Let's setup some basic appearance options
               // This could and should normally be done in a separate CSS class using the CssClass property
               $this->dlgSimpleMessage->Width = '500px';
               $this->dlgSimpleMessage->Height = '300px';
               $this->dlgSimpleMessage->Overflow = QOverflow::Auto;
               $this->dlgSimpleMessage->Padding = '10px';
               $this->dlgSimpleMessage->FontSize = '24px';
               $this->dlgSimpleMessage->FontNames = QFontFamily::Georgia;
               $this->dlgSimpleMessage->BackColor = '#eeffdd';
               // Make sure this Dislog Box is “hidden”
               // Like any other QPanel or QControl, this can be toggled using the “Display” or the “Visible” property
               $this->dlgSimpleMessage->Display = false;
           }
           $strControlId = 'Display' . $intConteId;
           $this->btnDisplaySimpleMessage = $this->GetControl($strControlId);
           if (!$this->btnDisplaySimpleMessage) {
               // The First “Display Simple Message” button will utilize an AJAX call to Show the Dialog Box
               $this->btnDisplaySimpleMessage = new QButton($this->dtgConte,$strControlId);
               $this->btnDisplaySimpleMessage->ActionParameter = 'Dialog' . $intConteId;;
               $this->btnDisplaySimpleMessage->Text = $objSupressionMotif->Motif;
               $this->btnDisplaySimpleMessage->AddAction(new QClickEvent(), new QAjaxAction('btnDisplaySimpleMessage_Click'));
           }
           return $this->btnDisplaySimpleMessage->Render(false);
       }
       return null;

   }

   protected function btnDisplaySimpleMessage_Click($strFormId, $strControlId, $strParameter) {
       // “Show” the Dialog Box using the ShowDialogBox() method
       $this->dlgSimpleMessage = $this->GetControl($strParameter);
       $this->dlgSimpleMessage->ShowDialogBox();
   }

When I click the btnDisplay I have this prompt:
Result of expression 'qc.getWrapper('Dialog16')' [undefined] is not an object.
on line number undefined
in file undefined

??? Thank you for help

#2  |  Vass Arpad (Szentegyháza, RO) Romania Qcodo Core Contributor
Friday, April 2, 2010, 4:36 PM PDT

Hi,

you have to render the DialogBox, too. Not only the Display button for it.

like this:
bc.
<?php
   public function dtgConte_motif_Render($intConteId) {


.....
          return $this->dlgSimpleMessage->Render(false) . $this->btnDisplaySimpleMessage->Render(false);
      }
      return null;

  }
?>
.bc

on a side note, if you don't use the controls outside of the Render function, you should use them as simple variables, not as QForm variables.

and also you maybe want to hide the btnDisplaySimpleMessage after the dialog box is shown. In this case you could set as the ActionParameter only the $intConteId, and change your click method:

<?php
   
protected function btnDisplaySimpleMessage_Click($strFormId$strControlId$strParameter) {
       
// “Show” the Dialog Box using the ShowDialogBox() method
       
$dlgSimpleMessage $this->GetControl('Dialog'.$strParameter);
       if(
$dlgSimpleMessage$dlgSimpleMessage->ShowDialogBox();
       
$btnDisplaySimpleMessage $this->GetControl($strControlId);
       
$btnDisplaySimpleMessage->Visible false;

   }
 
?>

if you want to do something similar to inline edit for datagrid rows, you can check the examples site : DataGrid with inline editing

hope this helps. :)

#3  |  Mattia Bagiella (Switzerland) Switzerland
Saturday, April 3, 2010, 1:06 AM PDT

Yeeeesssssssss, thankyou qcodo master <3 <3

It work very perfectly. Thanks thanks

PS : How do you make colorfull “bc. .bc” ???

#4  |  Vass Arpad (Szentegyháza, RO) Romania Qcodo Core Contributor
Saturday, April 3, 2010, 1:23 PM PDT

Use the <?php   ?> tags inside the bc. .bc,

and for more formatting options check the footer link of a reply box :)

“... To apply formatting, use QTextStyle Formatting.  “

regards,

Arpi.



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.