You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Krüger, Olaf <OK...@edscha.com> on 2012/11/28 11:01:36 UTC

How to disable ItemEditor depending on node level in Datagrid that contains hierarchicalData

Hi,
hope this mailing list is the right place to ask for help, if not  please let me know!

I want to disable an ItemEditor for some cells inside an AdvancedDataGrid (Tree view) depending on the node level (tree depth) of the clicked cell.
The clicked cell shouldn't be editable.

This is what I currently have:

                <fx:Script>
                               <![CDATA[
                                               ...
                                               private function disableEditing(event:AdvancedDataGridEvent):void
{
               // rowIndex don't fit my needs, is there a possibility to get the node level (tree depth) of the clicked cell?
                                                               if(event.rowIndex==0)
{
                                                                              event.preventDefault();
                                                               }
                                               }
...
                                               ]]>
                </fx:Script>

                <mx:AdvancedDataGrid id="dgBOMList" designViewDataType="tree" dataProvider="{hierarchicalView}" editable="true" itemEditBegin="disableEditing(event)">
                               ...
                                                               <mx:AdvancedDataGridColumn id="quantity" dataField="quantity" editorDataField="value"
                                                                              <mx:itemEditor>
                                                                                              <fx:Component>
                                                                                                              <mx:NumericStepper stepSize="1" maximum="999"/>
                                                                                              </fx:Component>
                                                                              </mx:itemEditor>
                                                               </mx:AdvancedDataGridColumn>
...
                </mx AdvancedDataGrid>


Is there anybody out there who can give me a hint?

Many thanks in advance!

Olaf



________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario Eikelmann, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

AW: How to disable ItemEditor depending on node level in Datagrid that contains hierarchicalData

Posted by Krüger, Olaf <OK...@edscha.com>.
I've got it. Many thanks for help!

Olaf

-----Ursprüngliche Nachricht-----
Von: Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Gesendet: Mittwoch, 28. November 2012 16:57
An: flex-users@incubator.apache.org
Betreff: RE: How to disable ItemEditor depending on node level in Datagrid that contains hierarchicalData

If your objects don't store any hierarchical information, you can use HierarchicalCollectionView.getNodeDepth(node:Object):int

Eg.  if (hierarchicalView. getNodeDepth(event.item) == xx ) =>

Note that getNodeDepth() traverses the tree hierarchy each time, and uses maps for parent relationships,  so it would run much faster  if you compute and store the hierarchical depth in your data and access it directly.

Maurice

-----Message d'origine-----
De : Harbs [mailto:harbs.lists@gmail.com] Envoyé : mercredi 28 novembre 2012 15:30 À : flex-users@incubator.apache.org Objet : Re: How to disable ItemEditor depending on node level in Datagrid that contains hierarchicalData

I'd probably do it based on the data/dataProvider. Getting the hierarchy there should be straightforward.

HTH,
Harbs
On Nov 28, 2012, at 12:01 PM, Krüger, Olaf wrote:

> Hi,
> hope this mailing list is the right place to ask for help, if not  please let me know!
>
> I want to disable an ItemEditor for some cells inside an AdvancedDataGrid (Tree view) depending on the node level (tree depth) of the clicked cell.
> The clicked cell shouldn't be editable.
>
> This is what I currently have:
>
>                <fx:Script>
>                               <![CDATA[
>                                               ...
>                                               private function
> disableEditing(event:AdvancedDataGridEvent):void
> {
>               // rowIndex don't fit my needs, is there a possibility to get the node level (tree depth) of the clicked cell?
>
> if(event.rowIndex==0) {
>                                                                              event.preventDefault();
>                                                               }
>                                               } ...
>                                               ]]>
>                </fx:Script>
>
>                <mx:AdvancedDataGrid id="dgBOMList" designViewDataType="tree" dataProvider="{hierarchicalView}" editable="true" itemEditBegin="disableEditing(event)">
>                               ...
>                                                               <mx:AdvancedDataGridColumn id="quantity" dataField="quantity" editorDataField="value"
>                                                                              <mx:itemEditor>
>                                                                                              <fx:Component>
>                                                                                                              <mx:NumericStepper stepSize="1" maximum="999"/>
>                                                                                              </fx:Component>
>
> </mx:itemEditor>
>
> </mx:AdvancedDataGridColumn> ...
>                </mx AdvancedDataGrid>
>
>
> Is there anybody out there who can give me a hint?
>
> Many thanks in advance!
>
> Olaf
>
>
>
> ________________________________
>
> Edscha Holding GmbH
> Sitz der Gesellschaft: Remscheid
> Registergericht: Wuppertal, HRB 22889
> Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera,
> Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario
> Eikelmann, Hans-Peter Schulz und Volker Weiss
>
> Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.
>
> Solely Managing Directors or employees with a written proxy have got power of representation.
>
> Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.
>
> The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.


________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario Eikelmann, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

RE: How to disable ItemEditor depending on node level in Datagrid that contains hierarchicalData

Posted by Maurice Amsellem <ma...@systar.com>.
If your objects don't store any hierarchical information, you can use HierarchicalCollectionView.getNodeDepth(node:Object):int 

Eg.  if (hierarchicalView. getNodeDepth(event.item) == xx ) => 

Note that getNodeDepth() traverses the tree hierarchy each time, and uses maps for parent relationships,  so it would run much faster  if you compute and store the hierarchical depth in 
your data and access it directly.

Maurice 

-----Message d'origine-----
De : Harbs [mailto:harbs.lists@gmail.com] 
Envoyé : mercredi 28 novembre 2012 15:30
À : flex-users@incubator.apache.org
Objet : Re: How to disable ItemEditor depending on node level in Datagrid that contains hierarchicalData

I'd probably do it based on the data/dataProvider. Getting the hierarchy there should be straightforward.

HTH,
Harbs
On Nov 28, 2012, at 12:01 PM, Krüger, Olaf wrote:

> Hi,
> hope this mailing list is the right place to ask for help, if not  please let me know!
> 
> I want to disable an ItemEditor for some cells inside an AdvancedDataGrid (Tree view) depending on the node level (tree depth) of the clicked cell.
> The clicked cell shouldn't be editable.
> 
> This is what I currently have:
> 
>                <fx:Script>
>                               <![CDATA[
>                                               ...
>                                               private function 
> disableEditing(event:AdvancedDataGridEvent):void
> {
>               // rowIndex don't fit my needs, is there a possibility to get the node level (tree depth) of the clicked cell?
>                                                               
> if(event.rowIndex==0) {
>                                                                              event.preventDefault();
>                                                               }
>                                               } ...
>                                               ]]>
>                </fx:Script>
> 
>                <mx:AdvancedDataGrid id="dgBOMList" designViewDataType="tree" dataProvider="{hierarchicalView}" editable="true" itemEditBegin="disableEditing(event)">
>                               ...
>                                                               <mx:AdvancedDataGridColumn id="quantity" dataField="quantity" editorDataField="value"
>                                                                              <mx:itemEditor>
>                                                                                              <fx:Component>
>                                                                                                              <mx:NumericStepper stepSize="1" maximum="999"/>
>                                                                                              </fx:Component>
>                                                                              </mx:itemEditor>
>                                                               
> </mx:AdvancedDataGridColumn> ...
>                </mx AdvancedDataGrid>
> 
> 
> Is there anybody out there who can give me a hint?
> 
> Many thanks in advance!
> 
> Olaf
> 
> 
> 
> ________________________________
> 
> Edscha Holding GmbH
> Sitz der Gesellschaft: Remscheid
> Registergericht: Wuppertal, HRB 22889
> Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera, 
> Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario 
> Eikelmann, Hans-Peter Schulz und Volker Weiss
> 
> Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.
> 
> Solely Managing Directors or employees with a written proxy have got power of representation.
> 
> Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.
> 
> The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.


Re: How to disable ItemEditor depending on node level in Datagrid that contains hierarchicalData

Posted by Harbs <ha...@gmail.com>.
I'd probably do it based on the data/dataProvider. Getting the hierarchy there should be straightforward…

HTH,
Harbs
On Nov 28, 2012, at 12:01 PM, Krüger, Olaf wrote:

> Hi,
> hope this mailing list is the right place to ask for help, if not  please let me know!
> 
> I want to disable an ItemEditor for some cells inside an AdvancedDataGrid (Tree view) depending on the node level (tree depth) of the clicked cell.
> The clicked cell shouldn't be editable.
> 
> This is what I currently have:
> 
>                <fx:Script>
>                               <![CDATA[
>                                               ...
>                                               private function disableEditing(event:AdvancedDataGridEvent):void
> {
>               // rowIndex don't fit my needs, is there a possibility to get the node level (tree depth) of the clicked cell?
>                                                               if(event.rowIndex==0)
> {
>                                                                              event.preventDefault();
>                                                               }
>                                               }
> ...
>                                               ]]>
>                </fx:Script>
> 
>                <mx:AdvancedDataGrid id="dgBOMList" designViewDataType="tree" dataProvider="{hierarchicalView}" editable="true" itemEditBegin="disableEditing(event)">
>                               ...
>                                                               <mx:AdvancedDataGridColumn id="quantity" dataField="quantity" editorDataField="value"
>                                                                              <mx:itemEditor>
>                                                                                              <fx:Component>
>                                                                                                              <mx:NumericStepper stepSize="1" maximum="999"/>
>                                                                                              </fx:Component>
>                                                                              </mx:itemEditor>
>                                                               </mx:AdvancedDataGridColumn>
> ...
>                </mx AdvancedDataGrid>
> 
> 
> Is there anybody out there who can give me a hint?
> 
> Many thanks in advance!
> 
> Olaf
> 
> 
> 
> ________________________________
> 
> Edscha Holding GmbH
> Sitz der Gesellschaft: Remscheid
> Registergericht: Wuppertal, HRB 22889
> Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario Eikelmann, Hans-Peter Schulz und Volker Weiss
> 
> Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.
> 
> Solely Managing Directors or employees with a written proxy have got power of representation.
> 
> Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.
> 
> The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.