【问题标题】:Qcube/Qcodo dynamic input fieldsQcube/Qcodo 动态输入字段
【发布时间】:2012-12-16 07:32:05
【问题描述】:

有没有人有一个例子,我如何在我的 qcubed 项目中添加动态输入字段? 谢谢!

【问题讨论】:

    标签: dynamic input field qcodo


    【解决方案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 示例网站上获取有关使用 QPanel 的更多信息。

    QCubed QPanel Example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-24
      • 2016-06-05
      • 1970-01-01
      • 2021-11-13
      • 1970-01-01
      • 2019-03-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多