@@ -59,10 +59,10 @@ |
||
| 59 | 59 | '\Ext\Data\Proxy\Ajax' => ['type'=>'ajax'], |
| 60 | 60 | '\Ext\Data\Proxy\Server' => ['type'=>'server'] |
| 61 | 61 | ]; |
| 62 | - $readers = [ |
|
| 63 | - '\Ext\Data\Reader\Json' => ['type'=>'json'], |
|
| 64 | - '\Ext\Data\Reader\Reader' => ['type'=>'base'], |
|
| 65 | - ]; |
|
| 62 | + $readers = [ |
|
| 63 | + '\Ext\Data\Reader\Json' => ['type'=>'json'], |
|
| 64 | + '\Ext\Data\Reader\Reader' => ['type'=>'base'], |
|
| 65 | + ]; |
|
| 66 | 66 | $plugins = [ |
| 67 | 67 | '\Ext\Grid\Filters\Filters' => ['ptype'=>'gridfilters'], |
| 68 | 68 | '\Ext\Grid\Filters\Filter\Boolean' => ['type'=>'boolean'], |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | class ExtSerializer extends ArraySerializer |
| 15 | 15 | {
|
| 16 | - public function serialize(SerializableObject $object) |
|
| 17 | - {
|
|
| 18 | - return json_encode(parent::serialize($object),JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); |
|
| 19 | - } |
|
| 16 | + public function serialize(SerializableObject $object) |
|
| 17 | + {
|
|
| 18 | + return json_encode(parent::serialize($object),JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -15,70 +15,70 @@ |
||
| 15 | 15 | class ArraySerializer implements Serializer |
| 16 | 16 | {
|
| 17 | 17 | |
| 18 | - protected $resolver; |
|
| 18 | + protected $resolver; |
|
| 19 | 19 | |
| 20 | - public function serialize(SerializableObject $object) |
|
| 21 | - {
|
|
| 22 | - return $this->serializeValue($object); |
|
| 23 | - } |
|
| 20 | + public function serialize(SerializableObject $object) |
|
| 21 | + {
|
|
| 22 | + return $this->serializeValue($object); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @return ExtResolver |
|
| 27 | - */ |
|
| 28 | - protected function getResolver(){
|
|
| 29 | - if(!$this->resolver){
|
|
| 30 | - $this->setResolver(new ExtResolver()); |
|
| 31 | - } |
|
| 32 | - return $this->resolver; |
|
| 33 | - } |
|
| 25 | + /** |
|
| 26 | + * @return ExtResolver |
|
| 27 | + */ |
|
| 28 | + protected function getResolver(){
|
|
| 29 | + if(!$this->resolver){
|
|
| 30 | + $this->setResolver(new ExtResolver()); |
|
| 31 | + } |
|
| 32 | + return $this->resolver; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function setResolver(ExtResolver $resolver){
|
|
| 36 | - $this->resolver = $resolver; |
|
| 37 | - } |
|
| 35 | + public function setResolver(ExtResolver $resolver){
|
|
| 36 | + $this->resolver = $resolver; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - protected function serializeAssociativeArray($array) {
|
|
| 40 | - if($array instanceof Serializable){
|
|
| 41 | - $type = $this->getResolver()->resolve($array); |
|
| 42 | - $array = $array->properties(); |
|
| 43 | - if($type){
|
|
| 44 | - $array = $type + $array; |
|
| 45 | - } |
|
| 46 | - } |
|
| 39 | + protected function serializeAssociativeArray($array) {
|
|
| 40 | + if($array instanceof Serializable){
|
|
| 41 | + $type = $this->getResolver()->resolve($array); |
|
| 42 | + $array = $array->properties(); |
|
| 43 | + if($type){
|
|
| 44 | + $array = $type + $array; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - if(!$array) return new \stdClass(); |
|
| 48 | + if(!$array) return new \stdClass(); |
|
| 49 | 49 | |
| 50 | - $serialized = array(); |
|
| 51 | - foreach ($array as $key => $value) {
|
|
| 52 | - $serialized[$key] = $this->serializeValue($value); |
|
| 53 | - } |
|
| 50 | + $serialized = array(); |
|
| 51 | + foreach ($array as $key => $value) {
|
|
| 52 | + $serialized[$key] = $this->serializeValue($value); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - return $serialized; |
|
| 56 | - } |
|
| 55 | + return $serialized; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - protected function serializeArray(array $array) {
|
|
| 59 | - $out = array(); |
|
| 58 | + protected function serializeArray(array $array) {
|
|
| 59 | + $out = array(); |
|
| 60 | 60 | |
| 61 | - foreach($array as $e){
|
|
| 62 | - $out[] = $this->serializeValue($e); |
|
| 63 | - } |
|
| 64 | - return $out; |
|
| 65 | - } |
|
| 61 | + foreach($array as $e){
|
|
| 62 | + $out[] = $this->serializeValue($e); |
|
| 63 | + } |
|
| 64 | + return $out; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - protected function isAssociativeArray(array $array) {
|
|
| 68 | - return (bool)count(array_filter(array_keys($array), 'is_string')); |
|
| 69 | - } |
|
| 67 | + protected function isAssociativeArray(array $array) {
|
|
| 68 | + return (bool)count(array_filter(array_keys($array), 'is_string')); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - protected function serializeValue($value) {
|
|
| 72 | - if($value instanceof Serializable){
|
|
| 73 | - return $this->serializeAssociativeArray($value); |
|
| 74 | - } elseif(is_array($value)) {
|
|
| 75 | - if ($this->isAssociativeArray($value) || empty($value)) {
|
|
| 76 | - return $this->serializeAssociativeArray($value); |
|
| 77 | - } else {
|
|
| 78 | - return $this->serializeArray($value); |
|
| 79 | - } |
|
| 80 | - }else{
|
|
| 81 | - return $value; |
|
| 82 | - } |
|
| 83 | - } |
|
| 71 | + protected function serializeValue($value) {
|
|
| 72 | + if($value instanceof Serializable){
|
|
| 73 | + return $this->serializeAssociativeArray($value); |
|
| 74 | + } elseif(is_array($value)) {
|
|
| 75 | + if ($this->isAssociativeArray($value) || empty($value)) {
|
|
| 76 | + return $this->serializeAssociativeArray($value); |
|
| 77 | + } else {
|
|
| 78 | + return $this->serializeArray($value); |
|
| 79 | + } |
|
| 80 | + }else{
|
|
| 81 | + return $value; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | return $this->setProperty('storeId',$storeId);
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function getStoreId(){
|
|
| 39 | - return $this->getProperty('storeId');
|
|
| 40 | - } |
|
| 38 | + public function getStoreId(){
|
|
| 39 | + return $this->getProperty('storeId');
|
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * The number of records considered to form a 'page'. This is used to power the built-in paging using the nextPage |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | return $this->setProperty('pageSize',$pageSize);
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function getPageSize(){
|
|
| 53 | - return $this->getProperty('pageSize');
|
|
| 54 | - } |
|
| 52 | + public function getPageSize(){
|
|
| 53 | + return $this->getProperty('pageSize');
|
|
| 54 | + } |
|
| 55 | 55 | } |
| 56 | 56 | \ No newline at end of file |
@@ -14,19 +14,19 @@ |
||
| 14 | 14 | class Reader extends Base |
| 15 | 15 | {
|
| 16 | 16 | |
| 17 | - public function setRootProperty($rootProperty){
|
|
| 18 | - return $this->setProperty('rootProperty',$rootProperty);
|
|
| 19 | - } |
|
| 17 | + public function setRootProperty($rootProperty){
|
|
| 18 | + return $this->setProperty('rootProperty',$rootProperty);
|
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function getRootProperty(){
|
|
| 22 | - return $this->getProperty('rootProperty');
|
|
| 23 | - } |
|
| 21 | + public function getRootProperty(){
|
|
| 22 | + return $this->getProperty('rootProperty');
|
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function setTotalProperty($totalProperty){
|
|
| 26 | - return $this->setProperty('totalProperty',$totalProperty);
|
|
| 27 | - } |
|
| 25 | + public function setTotalProperty($totalProperty){
|
|
| 26 | + return $this->setProperty('totalProperty',$totalProperty);
|
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public function getTotalProperty(){
|
|
| 30 | - return $this->getProperty('totalProperty');
|
|
| 31 | - } |
|
| 29 | + public function getTotalProperty(){
|
|
| 30 | + return $this->getProperty('totalProperty');
|
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -11,12 +11,12 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Json extends Reader |
| 13 | 13 | {
|
| 14 | - public function setMetadataProperty($metadataProperty){
|
|
| 15 | - return $this->setProperty('metadataProperty',$metadataProperty);
|
|
| 16 | - } |
|
| 14 | + public function setMetadataProperty($metadataProperty){
|
|
| 15 | + return $this->setProperty('metadataProperty',$metadataProperty);
|
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function getMetadataProperty(){
|
|
| 19 | - return $this->getProperty('metadataProperty');
|
|
| 20 | - } |
|
| 18 | + public function getMetadataProperty(){
|
|
| 19 | + return $this->getProperty('metadataProperty');
|
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |
@@ -7,12 +7,12 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Proxy extends Base |
| 9 | 9 | {
|
| 10 | - public function setReader(Reader $reader){
|
|
| 11 | - return $this->setProperty('reader',$reader);
|
|
| 12 | - } |
|
| 10 | + public function setReader(Reader $reader){
|
|
| 11 | + return $this->setProperty('reader',$reader);
|
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - public function getReader(){
|
|
| 15 | - return $this->getProperty('reader');
|
|
| 16 | - } |
|
| 14 | + public function getReader(){
|
|
| 15 | + return $this->getProperty('reader');
|
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | \ No newline at end of file |
@@ -6,176 +6,176 @@ |
||
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | $navigation = Ext::create('Ext.Panel.Panel',[
|
| 9 | - 'region'=>'west', |
|
| 10 | - 'width' => 150, |
|
| 11 | - 'collapsible'=>true, |
|
| 12 | - 'title' => 'Navigation', |
|
| 13 | - 'frame' => true |
|
| 9 | + 'region'=>'west', |
|
| 10 | + 'width' => 150, |
|
| 11 | + 'collapsible'=>true, |
|
| 12 | + 'title' => 'Navigation', |
|
| 13 | + 'frame' => true |
|
| 14 | 14 | ]); |
| 15 | 15 | $content = Ext::create('Ext.Form.Panel',[
|
| 16 | - 'region' => 'center', |
|
| 17 | - 'title' => 'Content', |
|
| 18 | - 'frame' => true, |
|
| 16 | + 'region' => 'center', |
|
| 17 | + 'title' => 'Content', |
|
| 18 | + 'frame' => true, |
|
| 19 | 19 | ]); |
| 20 | 20 | $controls = [ |
| 21 | - Ext::create('Ext.Form.Field.Text',[
|
|
| 22 | - 'fieldLabel'=>'Test label', |
|
| 23 | - 'value' => 'Value', |
|
| 24 | - 'name' => 'fname', |
|
| 25 | - ]), |
|
| 26 | - Ext::create('Ext.Form.Field.Checkbox',[
|
|
| 27 | - 'fieldLabel'=>'Test checkbox', |
|
| 28 | - 'value' => false, |
|
| 29 | - 'name' => 'fname', |
|
| 30 | - ]), |
|
| 31 | - Ext::create('Ext.Form.Field.Combobox',[
|
|
| 32 | - 'fieldLabel'=>'Test combo', |
|
| 33 | - 'name' => 'fname', |
|
| 34 | - ]), |
|
| 35 | - Ext::create('Ext.Form.Field.Date',[
|
|
| 36 | - 'fieldLabel'=>'Test date', |
|
| 37 | - 'name' => 'fname', |
|
| 38 | - ]), |
|
| 39 | - Ext::create('Ext.Form.Field.Display',[
|
|
| 40 | - 'fieldLabel'=>'Test display', |
|
| 41 | - 'name' => 'fname', |
|
| 42 | - 'value' => 'display' |
|
| 43 | - ]), |
|
| 44 | - Ext::create('Ext.Form.Field.File',[
|
|
| 45 | - 'fieldLabel'=>'Test file', |
|
| 46 | - 'name' => 'fname', |
|
| 47 | - 'value' => 'display' |
|
| 48 | - ]), |
|
| 49 | - Ext::create('Ext.Form.Field.Hidden',[
|
|
| 50 | - 'fieldLabel'=>'Test file', |
|
| 51 | - 'name' => 'fname', |
|
| 52 | - 'value' => 'hidden' |
|
| 53 | - ]), |
|
| 54 | - Ext::create('Ext.Form.Field.Radio',[
|
|
| 55 | - 'fieldLabel'=>'Test radio', |
|
| 56 | - 'name' => 'fname', |
|
| 57 | - 'value' => 1, |
|
| 58 | - ]), |
|
| 59 | - Ext::create('Ext.Form.Field.TextArea',[
|
|
| 60 | - 'fieldLabel'=>'Test area', |
|
| 61 | - 'name' => 'fname', |
|
| 62 | - 'value' => 'area content', |
|
| 63 | - ]), |
|
| 64 | - Ext::create('Ext.Form.CheckboxGroup',[
|
|
| 65 | - 'fieldLabel'=>'Checkbox group', |
|
| 66 | - 'name' => 'fname', |
|
| 67 | - 'vertical' => true, |
|
| 68 | - 'columns' => 1, |
|
| 69 | - 'items' => [ |
|
| 70 | - Ext::create('Ext.Form.Field.Checkbox',[
|
|
| 71 | - 'fieldLabel'=>'Test checkbox', |
|
| 72 | - 'value' => false, |
|
| 73 | - 'name' => 'fname', |
|
| 74 | - ]), |
|
| 75 | - Ext::create('Ext.Form.Field.Checkbox',[
|
|
| 76 | - 'fieldLabel'=>'Test checkbox', |
|
| 77 | - 'value' => false, |
|
| 78 | - 'name' => 'fname', |
|
| 79 | - ]), |
|
| 80 | - ] |
|
| 81 | - ]), |
|
| 82 | - Ext::create('Ext.Form.RadioGroup',[
|
|
| 83 | - 'fieldLabel'=>'Radio group', |
|
| 84 | - 'name' => 'fname', |
|
| 85 | - 'vertical' => true, |
|
| 86 | - 'columns' => 1, |
|
| 87 | - 'items' => [ |
|
| 88 | - Ext::create('Ext.Form.Field.Radio',[
|
|
| 89 | - 'fieldLabel'=>'Test label', |
|
| 90 | - 'value' => false, |
|
| 91 | - 'name' => 'fname', |
|
| 92 | - ]), |
|
| 93 | - Ext::create('Ext.Form.Field.Radio',[
|
|
| 94 | - 'boxLabel'=>'Test boxLabel', |
|
| 95 | - 'value' => false, |
|
| 96 | - 'name' => 'fname', |
|
| 97 | - ]), |
|
| 98 | - ] |
|
| 99 | - ]), |
|
| 21 | + Ext::create('Ext.Form.Field.Text',[
|
|
| 22 | + 'fieldLabel'=>'Test label', |
|
| 23 | + 'value' => 'Value', |
|
| 24 | + 'name' => 'fname', |
|
| 25 | + ]), |
|
| 26 | + Ext::create('Ext.Form.Field.Checkbox',[
|
|
| 27 | + 'fieldLabel'=>'Test checkbox', |
|
| 28 | + 'value' => false, |
|
| 29 | + 'name' => 'fname', |
|
| 30 | + ]), |
|
| 31 | + Ext::create('Ext.Form.Field.Combobox',[
|
|
| 32 | + 'fieldLabel'=>'Test combo', |
|
| 33 | + 'name' => 'fname', |
|
| 34 | + ]), |
|
| 35 | + Ext::create('Ext.Form.Field.Date',[
|
|
| 36 | + 'fieldLabel'=>'Test date', |
|
| 37 | + 'name' => 'fname', |
|
| 38 | + ]), |
|
| 39 | + Ext::create('Ext.Form.Field.Display',[
|
|
| 40 | + 'fieldLabel'=>'Test display', |
|
| 41 | + 'name' => 'fname', |
|
| 42 | + 'value' => 'display' |
|
| 43 | + ]), |
|
| 44 | + Ext::create('Ext.Form.Field.File',[
|
|
| 45 | + 'fieldLabel'=>'Test file', |
|
| 46 | + 'name' => 'fname', |
|
| 47 | + 'value' => 'display' |
|
| 48 | + ]), |
|
| 49 | + Ext::create('Ext.Form.Field.Hidden',[
|
|
| 50 | + 'fieldLabel'=>'Test file', |
|
| 51 | + 'name' => 'fname', |
|
| 52 | + 'value' => 'hidden' |
|
| 53 | + ]), |
|
| 54 | + Ext::create('Ext.Form.Field.Radio',[
|
|
| 55 | + 'fieldLabel'=>'Test radio', |
|
| 56 | + 'name' => 'fname', |
|
| 57 | + 'value' => 1, |
|
| 58 | + ]), |
|
| 59 | + Ext::create('Ext.Form.Field.TextArea',[
|
|
| 60 | + 'fieldLabel'=>'Test area', |
|
| 61 | + 'name' => 'fname', |
|
| 62 | + 'value' => 'area content', |
|
| 63 | + ]), |
|
| 64 | + Ext::create('Ext.Form.CheckboxGroup',[
|
|
| 65 | + 'fieldLabel'=>'Checkbox group', |
|
| 66 | + 'name' => 'fname', |
|
| 67 | + 'vertical' => true, |
|
| 68 | + 'columns' => 1, |
|
| 69 | + 'items' => [ |
|
| 70 | + Ext::create('Ext.Form.Field.Checkbox',[
|
|
| 71 | + 'fieldLabel'=>'Test checkbox', |
|
| 72 | + 'value' => false, |
|
| 73 | + 'name' => 'fname', |
|
| 74 | + ]), |
|
| 75 | + Ext::create('Ext.Form.Field.Checkbox',[
|
|
| 76 | + 'fieldLabel'=>'Test checkbox', |
|
| 77 | + 'value' => false, |
|
| 78 | + 'name' => 'fname', |
|
| 79 | + ]), |
|
| 80 | + ] |
|
| 81 | + ]), |
|
| 82 | + Ext::create('Ext.Form.RadioGroup',[
|
|
| 83 | + 'fieldLabel'=>'Radio group', |
|
| 84 | + 'name' => 'fname', |
|
| 85 | + 'vertical' => true, |
|
| 86 | + 'columns' => 1, |
|
| 87 | + 'items' => [ |
|
| 88 | + Ext::create('Ext.Form.Field.Radio',[
|
|
| 89 | + 'fieldLabel'=>'Test label', |
|
| 90 | + 'value' => false, |
|
| 91 | + 'name' => 'fname', |
|
| 92 | + ]), |
|
| 93 | + Ext::create('Ext.Form.Field.Radio',[
|
|
| 94 | + 'boxLabel'=>'Test boxLabel', |
|
| 95 | + 'value' => false, |
|
| 96 | + 'name' => 'fname', |
|
| 97 | + ]), |
|
| 98 | + ] |
|
| 99 | + ]), |
|
| 100 | 100 | ]; |
| 101 | 101 | |
| 102 | 102 | $content->setItems($controls); |
| 103 | 103 | $content->setButtons( |
| 104 | 104 | [ |
| 105 | - Ext::create('Ext.Button.Button',[
|
|
| 106 | - 'text' => 'Button', |
|
| 107 | - ]), |
|
| 108 | - Ext::create('Ext.Button.Button',[
|
|
| 109 | - 'text' => 'Disabled Button', |
|
| 110 | - 'disabled' => true, |
|
| 111 | - ]), |
|
| 112 | - Ext::create('Ext.Button.Button',[
|
|
| 113 | - 'text' => 'Pressed Button', |
|
| 114 | - 'pressed' => true, |
|
| 115 | - ]), |
|
| 105 | + Ext::create('Ext.Button.Button',[
|
|
| 106 | + 'text' => 'Button', |
|
| 107 | + ]), |
|
| 108 | + Ext::create('Ext.Button.Button',[
|
|
| 109 | + 'text' => 'Disabled Button', |
|
| 110 | + 'disabled' => true, |
|
| 111 | + ]), |
|
| 112 | + Ext::create('Ext.Button.Button',[
|
|
| 113 | + 'text' => 'Pressed Button', |
|
| 114 | + 'pressed' => true, |
|
| 115 | + ]), |
|
| 116 | 116 | ] |
| 117 | 117 | ); |
| 118 | 118 | /** @var Ext\Grid\Panel $grid */ |
| 119 | 119 | |
| 120 | 120 | $grid = Ext::create('Ext.Grid.Panel', [
|
| 121 | - 'title' => 'Grid', |
|
| 122 | - 'region'=> 'south', |
|
| 123 | - 'height' => 300, |
|
| 124 | - 'frame' => true, |
|
| 125 | - 'controller' => 'foo', |
|
| 126 | - 'store' => Ext::create('Ext.data.Store',[
|
|
| 127 | - 'data'=>[ |
|
| 128 | - [ |
|
| 129 | - 'key' => 'First key', |
|
| 130 | - 'value' => 'First value', |
|
| 131 | - ], |
|
| 132 | - [ |
|
| 133 | - 'key' => 'Secons key', |
|
| 134 | - 'value' => 'Double click me', |
|
| 135 | - ], |
|
| 136 | - ], |
|
| 137 | - 'fields' => [ |
|
| 138 | - Ext::create('Ext.data.Field.Field',['name'=>'key']),
|
|
| 139 | - ], |
|
| 140 | - 'storeId' => 'testStore', |
|
| 141 | - ]), |
|
| 142 | - 'columns' => [ |
|
| 143 | - Ext::create('Ext.Grid.Column.Column',[
|
|
| 144 | - 'text' => 'First field', |
|
| 145 | - 'dataIndex' => 'key', |
|
| 146 | - ]), |
|
| 147 | - Ext::create('Ext.Grid.Column.Column',[
|
|
| 148 | - 'text' => 'Second field', |
|
| 149 | - 'dataIndex' => 'value', |
|
| 150 | - ]), |
|
| 151 | - ], |
|
| 152 | - 'dockedItems' => [ |
|
| 153 | - Ext::create('Ext.Toolbar.Paging',[
|
|
| 154 | - 'dock'=>'bottom', |
|
| 155 | - 'store'=>'testStore', |
|
| 156 | - 'displayInfo'=>true |
|
| 157 | - ]), |
|
| 158 | - ] |
|
| 159 | - ] |
|
| 121 | + 'title' => 'Grid', |
|
| 122 | + 'region'=> 'south', |
|
| 123 | + 'height' => 300, |
|
| 124 | + 'frame' => true, |
|
| 125 | + 'controller' => 'foo', |
|
| 126 | + 'store' => Ext::create('Ext.data.Store',[
|
|
| 127 | + 'data'=>[ |
|
| 128 | + [ |
|
| 129 | + 'key' => 'First key', |
|
| 130 | + 'value' => 'First value', |
|
| 131 | + ], |
|
| 132 | + [ |
|
| 133 | + 'key' => 'Secons key', |
|
| 134 | + 'value' => 'Double click me', |
|
| 135 | + ], |
|
| 136 | + ], |
|
| 137 | + 'fields' => [ |
|
| 138 | + Ext::create('Ext.data.Field.Field',['name'=>'key']),
|
|
| 139 | + ], |
|
| 140 | + 'storeId' => 'testStore', |
|
| 141 | + ]), |
|
| 142 | + 'columns' => [ |
|
| 143 | + Ext::create('Ext.Grid.Column.Column',[
|
|
| 144 | + 'text' => 'First field', |
|
| 145 | + 'dataIndex' => 'key', |
|
| 146 | + ]), |
|
| 147 | + Ext::create('Ext.Grid.Column.Column',[
|
|
| 148 | + 'text' => 'Second field', |
|
| 149 | + 'dataIndex' => 'value', |
|
| 150 | + ]), |
|
| 151 | + ], |
|
| 152 | + 'dockedItems' => [ |
|
| 153 | + Ext::create('Ext.Toolbar.Paging',[
|
|
| 154 | + 'dock'=>'bottom', |
|
| 155 | + 'store'=>'testStore', |
|
| 156 | + 'displayInfo'=>true |
|
| 157 | + ]), |
|
| 158 | + ] |
|
| 159 | + ] |
|
| 160 | 160 | ); |
| 161 | 161 | |
| 162 | 162 | $grid->addListener(Ext::create('Ext.Event.Listener',[
|
| 163 | - 'event' => 'rowdblclick', |
|
| 164 | - 'function' => 'alert', |
|
| 165 | - 'scope' => 'self.controller' |
|
| 163 | + 'event' => 'rowdblclick', |
|
| 164 | + 'function' => 'alert', |
|
| 165 | + 'scope' => 'self.controller' |
|
| 166 | 166 | ])); |
| 167 | 167 | |
| 168 | 168 | $component = Ext::create('Ext.Container.Viewport',[
|
| 169 | - 'layout' => 'border', |
|
| 170 | - 'items' => [$navigation, $content, $grid] |
|
| 169 | + 'layout' => 'border', |
|
| 170 | + 'items' => [$navigation, $content, $grid] |
|
| 171 | 171 | ]); |
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | $componentJSON = $component->serialize(new \Ext\Serializer\ExtSerializer()); |
| 175 | 175 | |
| 176 | 176 | if(array_key_exists('json',$_REQUEST)){
|
| 177 | - echo $componentJSON; |
|
| 178 | - die(); |
|
| 177 | + echo $componentJSON; |
|
| 178 | + die(); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |