2 Replies Latest reply on Aug 9, 2011 1:53 AM by nikos101

    Best way to mark data that has changed when it is edited in  a spark datagrid?

    nikos101 Level 2

      I am not sure if this is the best way to mark data that has changed (isModifiedClientSide ) when it is edited in  a spark datagrid:

       

      <GridColumn  width="140" headerText="Margin "dataField="margin" editable="false"  editable.editMode="true"  >
                          <itemRenderer>
                              <fx:Component>
                                  <DefaultGridItemRenderer textAlign="right"   background="true" backgroundColor="#ffffff"  alpha="1.0" color="#000000" >
                                      <focusOut>
                                          <![CDATA[
                                          this.data.isModifiedClientSide = 1;
                                          ]]>
                                      </focusOut>
                                  </DefaultGridItemRenderer>
                              </fx:Component>
                          </itemRenderer>
                      </GridColumn>

        • 1. Re: Best way to mark data that has changed when it is edited in  a spark datagrid?
          Karl_Sigiscar_1971 Level 3

          Hi,

           

          Best practice is to do that in a valueCommit event handler. This way, it will work whether the user tabs outside, clicks outside or presses enter. The valueCommit event is defined in the UIComponent superclass:

           


          //--------------------------------------
          //  Validation events
          //--------------------------------------

           

          /**
          *  Dispatched when values are changed programmatically
          *  or by user interaction.
          *
          *  <p>Because a programmatic change triggers this event, make sure
          *  that any <code>valueCommit</code> event handler does not change
          *  a value that causes another <code>valueCommit</code> event.
          *  For example, do not change a control's <code>dataProvider</code>
          *  property in a <code>valueCommit</code> event handler. </p>
          *
          *  @eventType mx.events.FlexEvent.VALUE_COMMIT

          *  @langversion 3.0
          *  @playerversion Flash 9
          *  @playerversion AIR 1.1
          *  @productversion Flex 3
          */
          [Event(name="valueCommit", type="mx.events.FlexEvent")]

          1 person found this helpful
          • 2. Re: Best way to mark data that has changed when it is edited in  a spark datagrid?
            nikos101 Level 2

            I tried this but the value commit doesnt't get fired bro:

             

                <GridColumn  width="140" headerText="Margin (disabled)" headerText.editMode="Margin (editing)" dataField="margin" editable="false"  editable.editMode="true"  >
                                <itemEditor>
                                    <fx:Component>
                                        <DefaultGridItemEditor>
                                            <valueCommit>
                                                <![CDATA[
                                                this.data.isModifiedClientSide = 1;
                                                ]]>
                                            </valueCommit>
                                        </DefaultGridItemEditor>
                                    </fx:Component>
                                </itemEditor>
                               
                            </GridColumn>

             

             

            what do you think?