Example #1
0
 /**
  * 
  * @param PhpExt_Data_FieldConfigObject|string $field
  * @return PhpExt_Data_FieldConfigObject
  */
 public function addField($field)
 {
     if (is_string($field)) {
         $field = new PhpExt_Data_FieldConfigObject($field);
     }
     $this->_fields->add($field);
     return $field;
 }
Example #2
0
 /**
  * 
  * @param PhpExt_Data_FieldConfigObject|string $field
  * @return PhpExt_Data_FieldConfigObject
  */
 public function addField($field)
 {
     if (is_string($field)) {
         include_once 'PhpExt/Data/FieldConfigObject.php ';
     }
     $field = new PhpExt_Data_FieldConfigObject($field);
     $this->_fields->add($field);
     return $field;
 }
Example #3
0
 /**
  * @param PhpExt_Data_FieldConfigObject $field
  * @return PhpExt_Data_FieldConfigObject
  */
 public function addField($field)
 {
     $this->_fields->add($field, $field->getName());
     return $field;
 }
Example #4
0
$checkColumn->setDataIndex("indoor");
$checkColumn->setWidth(55);
// the column model has information about grid columns
//dataIndex maps the column to the specific data field in
// the data store (created below)
// ColumnModel
$txtCommon = PhpExt_Form_TextField::createTextField('txtCommon')->setAllowBlank(false);
$cmbLight = PhpExt_Form_ComboBox::createComboBox("cmbLight")->setTypeAhead(true)->setTriggerAction(PhpExt_Form_ComboBox::TRIGGER_ACTION_ALL)->setTransform("light")->setLazyRender(true)->setListCssClass('x-combo-list-small');
$txtPrice = PhpExt_Form_NumberField::createNumberField("txtPrice")->setAllowBlank(false)->setAllowNegative(false)->setMaxValue(100000);
$dtAvailable = PhpExt_Form_DateField::createDateField("dtAvaliable")->setFormat("m/d/y")->setMinValue("01/01/06")->setDisabledDays(array(0, 6))->setDisabledDaysText("Plants are not available on the weekends");
$colModel = new PhpExt_Grid_ColumnModel();
$colModel->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Common Name", "common", "common", 220)->setEditor($txtCommon))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Light", "light", null, 130)->setEditor($cmbLight))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Price", "price", "price", 70, PhpExt_Ext::HALIGN_RIGHT, "usMoney")->setEditor($txtPrice))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Avaliable", "availDate", "availDate", 95, null, PhpExt_Javascript::variable('formatDate'))->setEditor($dtAvailable))->addColumn($checkColumn);
// this could be inline, but we want to define the Plant record
// type so we can add records dynamically
$fields = new PhpExt_Data_FieldConfigObjectCollection();
$fields->add(new PhpExt_Data_FieldConfigObject("common", null, PhpExt_Data_FieldConfigObject::TYPE_STRING));
$fields->add(new PhpExt_Data_FieldConfigObject("botanical", null, PhpExt_Data_FieldConfigObject::TYPE_STRING));
$fields->add(new PhpExt_Data_FieldConfigObject("light"));
$fields->add(new PhpExt_Data_FieldConfigObject("price", null, PhpExt_Data_FieldConfigObject::TYPE_FLOAT));
$fields->add(new PhpExt_Data_FieldConfigObject("availDate", "availability", PhpExt_Data_FieldConfigObject::TYPE_DATE, "m/d/Y"));
$fields->add(new PhpExt_Data_FieldConfigObject("indoor", null, PhpExt_Data_FieldConfigObject::TYPE_BOOLEAN));
$plant = PhpExt_Data_Record::create($fields);
// Reader
$reader = new PhpExt_Data_XmlReader();
$reader->setRecord("plant");
$reader->setRecordType("Plant");
// Store
$store = new PhpExt_Data_Store();
$store->setUrl("examples/grid/plants.xml")->setReader($reader)->setSortInfo(new PhpExt_Data_SortInfoConfigObject("common"));
// Grid
$grid = new PhpExt_Grid_EditorGridPanel();