4

qcubedプロジェクトに動的に入力フィールドを追加する方法の例はありますか?ありがとう!

4

1 に答える 1

1

QPanel コントロールを利用して、オンザフライでコントロールを追加できます。その AutoRenderChildren 属性を true に設定し、動的コントロールの親を QPanel に設定するだけです。

// Instantiate our QPanel - this will render a div to contain our dynamic controls
// Note that the parent is $this. You will need to call render in your template
$this->pnl = new QPanel($this);
// Setting AutoRenderChildren so that the Panel will handle Rendering our dynamic
// controls.
$this->pnl->AutoRenderChildren = true;
// Creating a button with an Ajax action to create our dynamic controls
$this->btn = new QButton($this);
$this->btn->Text = "Add Control";
$this->btn->AddAction(new QClickEvent(), new QAjaxAction('btn_Click'));

protected function btn_Click($strFormId, $strControlId, $strParameter) {
    // create the control and set its parent to the QPanel 
    $ctl = new QTextBox($this->pnl);        
}

QCubed の例の Web サイトで QPanels の使用に関する詳細情報を入手できます。

QCubed QPanel の例

于 2013-02-05T03:21:55.750 に答える