ActionScript® 3.0 — dokumentacja dla platformy Adobe® Flash®
Strona główna  |  Ukryj listę pakietów i klas |  Pakiety  |  Klasy  |  Nowości  |  Indeks  |  Dodatki  |  Dlaczego język angielski?
Filtry: Pobieranie danych z serwera...
Pobieranie danych z serwera...
mx.collections 

GroupingField  - AS3 Flex

Pakietmx.collections
Klasapublic class GroupingField
DziedziczenieGroupingField Inheritance Object

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

The GroupingField class represents individual data fields that you use to group flat data for display by the AdvancedDataGrid control.

To populate the AdvancedDataGrid control with grouped data, you create an instance of the GroupingCollection class from your flat data, and then pass that GroupingCollection instance to the data provider of the AdvancedDataGrid control. To specify the grouping fields of your flat data, you pass a Grouping instance to the GroupingCollection.grouping property. The Grouping instance contains an Array of GroupingField instances, one per grouping field.

The following example uses the Grouping class to define two grouping fields: Region and Territory.

  <mx:AdvancedDataGrid id="myADG"    
    <mx:dataProvider> 
      <mx:GroupingCollection id="gc" source="{dpFlat}"> 
        <mx:grouping> 
          <mx:Grouping> 
            <mx:GroupingField name="Region"/> 
            <mx:GroupingField name="Territory"/> 
          </mx:Grouping> 
        </mx:grouping> 
      </mx:GroupingCollection> 
    </mx:dataProvider>  
     
    <mx:columns> 
      <mx:AdvancedDataGridColumn dataField="Region"/> 
      <mx:AdvancedDataGridColumn dataField="Territory"/> 
      <mx:AdvancedDataGridColumn dataField="Territory_Rep"/> 
      <mx:AdvancedDataGridColumn dataField="Actual"/> 
      <mx:AdvancedDataGridColumn dataField="Estimate"/> 
    </mx:columns> 
  </mx:AdvancedDataGrid>
  

Składnia MXMLexpandedUkryj składnię MXML
The <mx.GroupingField> inherits all the tag attributes of its superclass, and defines the following tag attributes:

  <mx:GroupingField
  Properties 
    caseInsensitive="false|true"
    compareFunction="No default"
    descending="false|true"
    groupingFunction="No default"
    groupingObjectFunction="No default"
    name="null"
    numeric="false|true"
    summaries="No default"
  />
  

Domyślna właściwość MXMLsummaries

Powiązane elementy interfejsu API



Właściwości publiczne
 WłaściwośćZdefiniowane przez
  caseInsensitive : Boolean
Set to true if the sort for this field should be case-insensitive.
GroupingField
  compareFunction : Function
The function that compares two items during a sort of items for the associated collection.
GroupingField
 Inheritedconstructor : Object
Odwołanie do obiektu klasy lub funkcji konstruktora, dotyczące danej instancji obiektu.
Object
  descending : Boolean
Set to true if the sort for this field should be in descending order.
GroupingField
  groupingFunction : Function
A function that determines the label for this group.
GroupingField
  groupingObjectFunction : Function
A callback function to run on each group node to determine the grouping object.
GroupingField
  name : String
The name of the field to be sorted.
GroupingField
  numeric : Boolean
Specifies that if the field being sorted contains numeric (Number/int/uint) values, or String representations of numeric values, the comparitor uses a numeric comparison.
GroupingField
  summaries : Array
Array of SummaryRow instances that define the group-level summaries.
GroupingField
Metody publiczne
 MetodaZdefiniowane przez
  
GroupingField(name:String = null, caseInsensitive:Boolean = false, descending:Boolean = false, numeric:Boolean = false)
Constructor.
GroupingField
 Inherited
Wskazuje, czy dla obiektu zdefiniowano określoną właściwość.
Object
 Inherited
Wskazuje, czy instancja klasy Object należy do łańcucha prototypów obiektu określonego jako parametr.
Object
 Inherited
Wskazuje, czy określona właściwość istnieje i jest przeliczalna.
Object
 Inherited
Ustawia dostępność właściwości dynamicznej używanej w pętlach.
Object
 Inherited
Zwraca ciąg reprezentujący obiekt — sformatowany zgodnie z konwencjami właściwymi dla ustawień regionalnych.
Object
 Inherited
Zwraca ciąg reprezentujący określony obiekt.
Object
 Inherited
Zwraca pierwotną wartość dla określonego obiektu.
Object
Szczegół właściwości

caseInsensitive

właściwość
caseInsensitive:Boolean

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

Set to true if the sort for this field should be case-insensitive.

Wartością domyślną jest false.



Implementacja
    public function get caseInsensitive():Boolean
    public function set caseInsensitive(value:Boolean):void

compareFunction

właściwość 
compareFunction:Function

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

The function that compares two items during a sort of items for the associated collection. If you specify a compareFunction property in a Grouping object, Flex ignores any compareFunction properties of the GroupingField objects.

The compare function must have the following signature:

function myCompare(a:Object, b:Object):int

This function must return the following values:

  • -1, if a should appear before b in the sorted sequence.
  • 0, if a equals b.
  • 1, if a should appear after b in the sorted sequence.

The default value is an internal compare function that can perform a string, numeric, or date comparison in ascending or descending order, with case-sensitive or case-insensitive string comparisons. Specify your own function only if you need a custom comparison algorithm. This is normally only the case if a calculated field is used in a display.



Implementacja
    public function get compareFunction():Function
    public function set compareFunction(value:Function):void

descending

właściwość 
descending:Boolean

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

Set to true if the sort for this field should be in descending order.

Wartością domyślną jest false.



Implementacja
    public function get descending():Boolean
    public function set descending(value:Boolean):void

groupingFunction

właściwość 
public var groupingFunction:Function

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

A function that determines the label for this group. By default, the group displays the text for the field in the data that matches the filed specified by the name property. However, sometimes you want to group the items based on more than one field in the data, or group based on something that is not a simple String field. In such a case, you specify a callback function by using the groupingFunction property.

A callback function might convert a number for the month into the String for the month, or group multiple items into a single group based on some criteria other than the actual value of the field.

For the GroupField, the method signature has the following form:

groupingFunction(item:Object, field:GroupField):String

Where item contains the data item object, and field contains the GroupField object.

For example, a groupingFunction which returns the first character as the group name can be written as -
      private function groupFunc(item:Object, field:GroupingField):String
      {
          return item[field.name].toString().substr(0, 1);
      }
      

groupingObjectFunction

właściwość 
public var groupingObjectFunction:Function

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

A callback function to run on each group node to determine the grouping object. By default, a new Object will be created for group nodes.

You can supply a groupingObjectFunction that provides the appropriate Object for group nodes.

The method signature is:

      myGroupObjectFunction(label:String):Object

Where label contains the value that will be shown for that group node. The function returns an Object that will be used for group nodes.

For example, a groupingObjectFunction which returns an Object containing a "name" property with value as "Bob" can be written as -
      private function groupObjFunction(label:String):Object
      {
          var obj:Object = {};
          obj.name = "Bob";
     
          return obj;
      }
      

name

właściwość 
name:String

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

The name of the field to be sorted.

Wartością domyślną jest null.



Implementacja
    public function get name():String
    public function set name(value:String):void

numeric

właściwość 
numeric:Boolean

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

Specifies that if the field being sorted contains numeric (Number/int/uint) values, or String representations of numeric values, the comparitor uses a numeric comparison. If this property is false, fields with String representations of numbers are sorted using String comparison, so 100 precedes 99, because "1" is a lower string value than "9".

Wartością domyślną jest false.



Implementacja
    public function get numeric():Boolean
    public function set numeric(value:Boolean):void

summaries

właściwość 
public var summaries:Array

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

Array of SummaryRow instances that define the group-level summaries. Specify one or more SummaryRow instances to define the data summaries, as the following example shows:

      <mx:AdvancedDataGrid id="myADG" 
         width="100%" height="100%" 
         initialize="gc.refresh();">        
         <mx:dataProvider>
             <mx:GroupingCollection id="gc" source="{dpFlat}">
                 <mx:Grouping>
                     <mx:GroupingField name="Region">
                       <mx:summaries>
                           <mx:SummaryRow summaryPlacement="group">
                             <mx:fields>
                                 <mx:SummaryField dataField="Actual" 
                                     label="Min Actual" operation="MIN"/>
                                 <mx:SummaryField dataField="Actual" 
                                     label="Max Actual" operation="MAX"/>
                             </mx:fields>
                           </mx:SummaryRow>
                         </mx:summaries>
                     </mx:GroupingField>
                 </mx:Grouping>
             </mx:GroupingCollection>
         </mx:dataProvider>        
         
         <mx:columns>
             <mx:AdvancedDataGridColumn dataField="Region"/>
             <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                 headerText="Territory Rep"/>
             <mx:AdvancedDataGridColumn dataField="Actual"/>
             <mx:AdvancedDataGridColumn dataField="Estimate"/>
             <mx:AdvancedDataGridColumn dataField="Min Actual"/>
             <mx:AdvancedDataGridColumn dataField="Max Actual"/>
         </mx:columns>
      </mx:AdvancedDataGrid>  
      

Powiązane elementy interfejsu API

Konstruktor Szczegół

GroupingField

()Konstruktor
public function GroupingField(name:String = null, caseInsensitive:Boolean = false, descending:Boolean = false, numeric:Boolean = false)

Wersja języka: ActionScript 3.0
Wersja produktu: Flex 3
Wersje środowiska wykonawczego: Flash Player 9, AIR 1.1

Constructor.

Parametry
name:String (default = null) — The name of the property that this field uses for comparison. If the object is a simple type, pass null.
 
caseInsensitive:Boolean (default = false) — When sorting strings, tells the comparitor whether to ignore the case of the values.
 
descending:Boolean (default = false) — Tells the comparator whether to arrange items in descending order.
 
numeric:Boolean (default = false) — Tells the comparitor whether to compare sort items as numbers, instead of alphabetically.




[ X ]Dlaczego język angielski?
Treść dokumentacji języka ActionScript 3.0 wyświetlana w języku angielskim

Niektóre części dokumentacji języka ActionScript 3.0 nie są przetłumaczone na poszczególne języki. Gdy element nie jest przetłumaczony na dany język, jest wyświetlany tekst angielski. Na przykład opis klasy ga.controls.HelpBox nie jest przetłumaczony na żaden dodatkowy język. Z tego powodu polska wersja dokumentacji zawiera opis klasy ga.controls.HelpBox w języku angielskim.