You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Deepak MS <me...@gmail.com> on 2014/12/10 10:30:08 UTC

How to avoid sorting on click of headerrenderer?

Hey guys,
I have a Datagrid with first column being a custom itemrenderer with a
check box, a box(to display color) and then a label.

I am using headererRenderer too for that column, but with a check box and a
button. The header's check box is used to check\uncheck all items in the
datagrid.

When I click on headererenderer's button or checkbox, the data is getting
sorted in the grid. I don't want to do sort when I click on any item in
headerenderer, I want to sort it only when user clicks on header apart from
that button and checkbox.

I tried to stop event propogation, but always header release event is
triggered first than headerrenderer's button or check box click. So stop
propagation wont work.

Is there anyway to avoid sorting on click of headerrenderer item? I'm using
Flex 3.6.

Cheers!

Re: How to avoid sorting on click of headerrenderer?

Posted by "pkumar.flex" <pr...@gmail.com>.
Do not use stop propagation in headerrenderer. Stop in parent or custom
component.
On Dec 10, 2014 3:02 PM, "Deepak MS [via Apache Flex Users]" <
ml-node+s2333346n9055h90@n4.nabble.com> wrote:

> Hey guys,
> I have a Datagrid with first column being a custom itemrenderer with a
> check box, a box(to display color) and then a label.
>
> I am using headererRenderer too for that column, but with a check box and
> a
> button. The header's check box is used to check\uncheck all items in the
> datagrid.
>
> When I click on headererenderer's button or checkbox, the data is getting
> sorted in the grid. I don't want to do sort when I click on any item in
> headerenderer, I want to sort it only when user clicks on header apart
> from
> that button and checkbox.
>
> I tried to stop event propogation, but always header release event is
> triggered first than headerrenderer's button or check box click. So stop
> propagation wont work.
>
> Is there anyway to avoid sorting on click of headerrenderer item? I'm
> using
> Flex 3.6.
>
> Cheers!
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-flex-users.2333346.n4.nabble.com/How-to-avoid-sorting-on-click-of-headerrenderer-tp9055.html
>  To unsubscribe from Apache Flex Users, click here
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=cHJhc2hha3VtYXJAZ21haWwuY29tfDF8LTU0MTcyMzE2NA==>
> .
> NAML
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/How-to-avoid-sorting-on-click-of-headerrenderer-tp9055p9057.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: How to avoid sorting on click of headerrenderer?

Posted by Deepak MS <me...@gmail.com>.
The problem is, always header release event is triggered before checkbox's
change event. (I don't know why. Logically, I thought checkbox's event
should trigger first and then header release should be triggered.)

If I add event.preventDefault in headerrelease, it affects other columns of
the grid(normal sorting wont work).

Hence, I added a boolean flag and I am setting it to true on checkbox's
mouseup event. And then on header release, I am avoiding
event.preventdefault based on this flag value. This works for me.

Thanks everyone.

On Thu, Dec 11, 2014 at 12:14 AM, Alex Harui <ah...@adobe.com> wrote:

> http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf66ce9
> -7fd6.html
>
> The “headerRelease” event can be cancelled with preventDefault.
>
> Also note that the checkbox change is probably a result of mouse events
> that the DG is using to send the headerRelease event, so another option is
> to stopImmediatePropagation on mouseEvents, but that might screw up
> something else.
>
> -Alex
>
> On 12/10/14, 2:27 AM, "Deepak MS" <me...@gmail.com> wrote:
>
> >Here's what I'm trying(sample application):
> >
> >
> ><?xml version="1.0" encoding="utf-8"?>
> ><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> >layout="vertical"
> >minWidth="955" minHeight="600" >
> >
> >    <mx:Script>
> >        <![CDATA[
> >            import mx.utils.ObjectUtil;
> >            public function
> >sortStringFunction(totalFieldName:String,totalValue:String,
> >fieldName:String,  isNumeric:Boolean = false):Function{
> >
> >                return function(obj1:Object, obj2:Object):int
> >                {
> >                    if(obj1[totalFieldName] == totalValue){
> >
> >
> >                        return 0;
> >
> >                    }else if(obj2[totalFieldName] == totalValue){
> >
> >
> >                        return 0;
> >
> >                    }else{
> >
> >                        if(isNumeric)
> >                        {
> >                            return
> >ObjectUtil.numericCompare(obj1[fieldName],obj2[fieldName]);
> >                        }else
> >                        {
> >                            return
> >ObjectUtil.stringCompare(obj1[fieldName],obj2[fieldName],true);
> >                        }
> >
> >                    }
> >
> >                }
> >            }
> >        ]]>
> >    </mx:Script>
> >
> >    <mx:ArrayCollection id="ac">
> >        <mx:Object ischecked="true" color="" name="ABC"/>
> >        <mx:Object ischecked="true" color="" name="KJHD"/>
> >        <mx:Object ischecked="true" color="" name="ADFDGG"/>
> >        <mx:Object ischecked="true" color="" name="SDF"/>
> >        <mx:Object ischecked="true" color="" name="TRF"/>
> >        <mx:Object ischecked="true" color="" name="DF"/>
> >        <mx:Object ischecked="true" color="" name="YTU"/>
> >        <mx:Object ischecked="true" color="" name="Total"/>
> >    </mx:ArrayCollection>
> >    <mx:DataGrid dataProvider="{ac}" width="500" height="500"
> >sortableColumns="true">
> >        <mx:columns>
> >            <mx:DataGridColumn sortable="true"
> >sortCompareFunction="{sortStringFunction('name','Total','name')}">
> >                <mx:headerRenderer>
> >                    <mx:Component>
> >                        <mx:VBox  paddingLeft="5" verticalAlign="middle"
> >horizontalAlign="left">
> >                            <mx:Script>
> >                                <![CDATA[
> >                                    import mx.controls.Alert;
> >                                    import mx.events.DataGridEvent;
> >
> >                                    protected function
> >checkbox2_changeHandler(event:Event):void
> >                                    {
> >
> >                                        /*  event.preventDefault();
> >                                        event.stopImmediatePropagation();
> >*/ // this doesn't avoid sorting. I want to avoid default sorting here
> >
> >                                        for each(var item:Object in
> >outerDocument.ac)
> >                                        {
> >                                            item['ischecked'] =
> >event.currentTarget.selected;
> >                                        }
> >
> >                                        outerDocument.ac.refresh();
> >                                    }
> >
> >
> >                                ]]>
> >                            </mx:Script>
> >
> >                            <mx:HBox>
> >                                <mx:Button width="15" height="15"/>
> >                                <mx:Label text="ATCs" />
> >                            </mx:HBox>
> >                            <mx:CheckBox
> >change="checkbox2_changeHandler(event)" label="Check All" />
> >                        </mx:VBox>
> >
> >                    </mx:Component>
> >                </mx:headerRenderer>
> >
> >                <mx:itemRenderer>
> >                    <mx:Component>
> >
> >                        <mx:CheckBox selected="{data.ischecked}" label="{
> >data.name}">
> >
> >                        </mx:CheckBox>
> >
> >                    </mx:Component>
> >                </mx:itemRenderer>
> >            </mx:DataGridColumn>
> >        </mx:columns>
> >    </mx:DataGrid>
> ></mx:Application>
> >
> >
> >On Wed, Dec 10, 2014 at 3:24 PM, Deepak MS <me...@gmail.com>
> >wrote:
> >
> >> Yes, I did. On click of header button, I called those 2 methods but it
> >> still sorts the column data.
> >>
> >> On Wed, Dec 10, 2014 at 3:15 PM, Evyatar Ben Halevi-Arbib <
> >> evyatarbh@gmail.com> wrote:
> >>
> >>> Have you tried using the following calls in your renderer's event
> >>>handler
> >>> function?
> >>> event.preventDefault();
> >>> event.stopImmediatePropagation()
> >>>
> >>> Regards,
> >>> Evyatar
> >>>
> >>> On Wed, Dec 10, 2014 at 11:30 AM, Deepak MS <me...@gmail.com>
> >>> wrote:
> >>>
> >>> > Hey guys,
> >>> > I have a Datagrid with first column being a custom itemrenderer with
> >>>a
> >>> > check box, a box(to display color) and then a label.
> >>> >
> >>> > I am using headererRenderer too for that column, but with a check box
> >>> and a
> >>> > button. The header's check box is used to check\uncheck all items in
> >>>the
> >>> > datagrid.
> >>> >
> >>> > When I click on headererenderer's button or checkbox, the data is
> >>> getting
> >>> > sorted in the grid. I don't want to do sort when I click on any item
> >>>in
> >>> > headerenderer, I want to sort it only when user clicks on header
> >>>apart
> >>> from
> >>> > that button and checkbox.
> >>> >
> >>> > I tried to stop event propogation, but always header release event is
> >>> > triggered first than headerrenderer's button or check box click. So
> >>>stop
> >>> > propagation wont work.
> >>> >
> >>> > Is there anyway to avoid sorting on click of headerrenderer item? I'm
> >>> using
> >>> > Flex 3.6.
> >>> >
> >>> > Cheers!
> >>> >
> >>>
> >>
> >>
>
>

Re: How to avoid sorting on click of headerrenderer?

Posted by Alex Harui <ah...@adobe.com>.
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf66ce9
-7fd6.html

The “headerRelease” event can be cancelled with preventDefault.

Also note that the checkbox change is probably a result of mouse events
that the DG is using to send the headerRelease event, so another option is
to stopImmediatePropagation on mouseEvents, but that might screw up
something else.

-Alex

On 12/10/14, 2:27 AM, "Deepak MS" <me...@gmail.com> wrote:

>Here's what I'm trying(sample application):
>
>
><?xml version="1.0" encoding="utf-8"?>
><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
>layout="vertical"
>minWidth="955" minHeight="600" >
>
>    <mx:Script>
>        <![CDATA[
>            import mx.utils.ObjectUtil;
>            public function
>sortStringFunction(totalFieldName:String,totalValue:String,
>fieldName:String,  isNumeric:Boolean = false):Function{
>
>                return function(obj1:Object, obj2:Object):int
>                {
>                    if(obj1[totalFieldName] == totalValue){
>
>
>                        return 0;
>
>                    }else if(obj2[totalFieldName] == totalValue){
>
>
>                        return 0;
>
>                    }else{
>
>                        if(isNumeric)
>                        {
>                            return
>ObjectUtil.numericCompare(obj1[fieldName],obj2[fieldName]);
>                        }else
>                        {
>                            return
>ObjectUtil.stringCompare(obj1[fieldName],obj2[fieldName],true);
>                        }
>
>                    }
>
>                }
>            }
>        ]]>
>    </mx:Script>
>
>    <mx:ArrayCollection id="ac">
>        <mx:Object ischecked="true" color="" name="ABC"/>
>        <mx:Object ischecked="true" color="" name="KJHD"/>
>        <mx:Object ischecked="true" color="" name="ADFDGG"/>
>        <mx:Object ischecked="true" color="" name="SDF"/>
>        <mx:Object ischecked="true" color="" name="TRF"/>
>        <mx:Object ischecked="true" color="" name="DF"/>
>        <mx:Object ischecked="true" color="" name="YTU"/>
>        <mx:Object ischecked="true" color="" name="Total"/>
>    </mx:ArrayCollection>
>    <mx:DataGrid dataProvider="{ac}" width="500" height="500"
>sortableColumns="true">
>        <mx:columns>
>            <mx:DataGridColumn sortable="true"
>sortCompareFunction="{sortStringFunction('name','Total','name')}">
>                <mx:headerRenderer>
>                    <mx:Component>
>                        <mx:VBox  paddingLeft="5" verticalAlign="middle"
>horizontalAlign="left">
>                            <mx:Script>
>                                <![CDATA[
>                                    import mx.controls.Alert;
>                                    import mx.events.DataGridEvent;
>
>                                    protected function
>checkbox2_changeHandler(event:Event):void
>                                    {
>
>                                        /*  event.preventDefault();
>                                        event.stopImmediatePropagation();
>*/ // this doesn't avoid sorting. I want to avoid default sorting here
>
>                                        for each(var item:Object in
>outerDocument.ac)
>                                        {
>                                            item['ischecked'] =
>event.currentTarget.selected;
>                                        }
>
>                                        outerDocument.ac.refresh();
>                                    }
>
>
>                                ]]>
>                            </mx:Script>
>
>                            <mx:HBox>
>                                <mx:Button width="15" height="15"/>
>                                <mx:Label text="ATCs" />
>                            </mx:HBox>
>                            <mx:CheckBox
>change="checkbox2_changeHandler(event)" label="Check All" />
>                        </mx:VBox>
>
>                    </mx:Component>
>                </mx:headerRenderer>
>
>                <mx:itemRenderer>
>                    <mx:Component>
>
>                        <mx:CheckBox selected="{data.ischecked}" label="{
>data.name}">
>
>                        </mx:CheckBox>
>
>                    </mx:Component>
>                </mx:itemRenderer>
>            </mx:DataGridColumn>
>        </mx:columns>
>    </mx:DataGrid>
></mx:Application>
>
>
>On Wed, Dec 10, 2014 at 3:24 PM, Deepak MS <me...@gmail.com>
>wrote:
>
>> Yes, I did. On click of header button, I called those 2 methods but it
>> still sorts the column data.
>>
>> On Wed, Dec 10, 2014 at 3:15 PM, Evyatar Ben Halevi-Arbib <
>> evyatarbh@gmail.com> wrote:
>>
>>> Have you tried using the following calls in your renderer's event
>>>handler
>>> function?
>>> event.preventDefault();
>>> event.stopImmediatePropagation()
>>>
>>> Regards,
>>> Evyatar
>>>
>>> On Wed, Dec 10, 2014 at 11:30 AM, Deepak MS <me...@gmail.com>
>>> wrote:
>>>
>>> > Hey guys,
>>> > I have a Datagrid with first column being a custom itemrenderer with
>>>a
>>> > check box, a box(to display color) and then a label.
>>> >
>>> > I am using headererRenderer too for that column, but with a check box
>>> and a
>>> > button. The header's check box is used to check\uncheck all items in
>>>the
>>> > datagrid.
>>> >
>>> > When I click on headererenderer's button or checkbox, the data is
>>> getting
>>> > sorted in the grid. I don't want to do sort when I click on any item
>>>in
>>> > headerenderer, I want to sort it only when user clicks on header
>>>apart
>>> from
>>> > that button and checkbox.
>>> >
>>> > I tried to stop event propogation, but always header release event is
>>> > triggered first than headerrenderer's button or check box click. So
>>>stop
>>> > propagation wont work.
>>> >
>>> > Is there anyway to avoid sorting on click of headerrenderer item? I'm
>>> using
>>> > Flex 3.6.
>>> >
>>> > Cheers!
>>> >
>>>
>>
>>


Re: How to avoid sorting on click of headerrenderer?

Posted by Evyatar Ben Halevi-Arbib <ev...@gmail.com>.
In that case, perhaps you could set sortableColumns to "false" and perform
your sorting logic in some other event listener...

On Wed, Dec 10, 2014 at 12:27 PM, Deepak MS <me...@gmail.com>
wrote:

> Here's what I'm trying(sample application):
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="vertical"
> minWidth="955" minHeight="600" >
>
>     <mx:Script>
>         <![CDATA[
>             import mx.utils.ObjectUtil;
>             public function
> sortStringFunction(totalFieldName:String,totalValue:String,
> fieldName:String,  isNumeric:Boolean = false):Function{
>
>                 return function(obj1:Object, obj2:Object):int
>                 {
>                     if(obj1[totalFieldName] == totalValue){
>
>
>                         return 0;
>
>                     }else if(obj2[totalFieldName] == totalValue){
>
>
>                         return 0;
>
>                     }else{
>
>                         if(isNumeric)
>                         {
>                             return
> ObjectUtil.numericCompare(obj1[fieldName],obj2[fieldName]);
>                         }else
>                         {
>                             return
> ObjectUtil.stringCompare(obj1[fieldName],obj2[fieldName],true);
>                         }
>
>                     }
>
>                 }
>             }
>         ]]>
>     </mx:Script>
>
>     <mx:ArrayCollection id="ac">
>         <mx:Object ischecked="true" color="" name="ABC"/>
>         <mx:Object ischecked="true" color="" name="KJHD"/>
>         <mx:Object ischecked="true" color="" name="ADFDGG"/>
>         <mx:Object ischecked="true" color="" name="SDF"/>
>         <mx:Object ischecked="true" color="" name="TRF"/>
>         <mx:Object ischecked="true" color="" name="DF"/>
>         <mx:Object ischecked="true" color="" name="YTU"/>
>         <mx:Object ischecked="true" color="" name="Total"/>
>     </mx:ArrayCollection>
>     <mx:DataGrid dataProvider="{ac}" width="500" height="500"
> sortableColumns="true">
>         <mx:columns>
>             <mx:DataGridColumn sortable="true"
> sortCompareFunction="{sortStringFunction('name','Total','name')}">
>                 <mx:headerRenderer>
>                     <mx:Component>
>                         <mx:VBox  paddingLeft="5" verticalAlign="middle"
> horizontalAlign="left">
>                             <mx:Script>
>                                 <![CDATA[
>                                     import mx.controls.Alert;
>                                     import mx.events.DataGridEvent;
>
>                                     protected function
> checkbox2_changeHandler(event:Event):void
>                                     {
>
>                                         /*  event.preventDefault();
>                                         event.stopImmediatePropagation();
> */ // this doesn't avoid sorting. I want to avoid default sorting here
>
>                                         for each(var item:Object in
> outerDocument.ac)
>                                         {
>                                             item['ischecked'] =
> event.currentTarget.selected;
>                                         }
>
>                                         outerDocument.ac.refresh();
>                                     }
>
>
>                                 ]]>
>                             </mx:Script>
>
>                             <mx:HBox>
>                                 <mx:Button width="15" height="15"/>
>                                 <mx:Label text="ATCs" />
>                             </mx:HBox>
>                             <mx:CheckBox
> change="checkbox2_changeHandler(event)" label="Check All" />
>                         </mx:VBox>
>
>                     </mx:Component>
>                 </mx:headerRenderer>
>
>                 <mx:itemRenderer>
>                     <mx:Component>
>
>                         <mx:CheckBox selected="{data.ischecked}" label="{
> data.name}">
>
>                         </mx:CheckBox>
>
>                     </mx:Component>
>                 </mx:itemRenderer>
>             </mx:DataGridColumn>
>         </mx:columns>
>     </mx:DataGrid>
> </mx:Application>
>
>
> On Wed, Dec 10, 2014 at 3:24 PM, Deepak MS <me...@gmail.com>
> wrote:
>
> > Yes, I did. On click of header button, I called those 2 methods but it
> > still sorts the column data.
> >
> > On Wed, Dec 10, 2014 at 3:15 PM, Evyatar Ben Halevi-Arbib <
> > evyatarbh@gmail.com> wrote:
> >
> >> Have you tried using the following calls in your renderer's event
> handler
> >> function?
> >> event.preventDefault();
> >> event.stopImmediatePropagation()
> >>
> >> Regards,
> >> Evyatar
> >>
> >> On Wed, Dec 10, 2014 at 11:30 AM, Deepak MS <me...@gmail.com>
> >> wrote:
> >>
> >> > Hey guys,
> >> > I have a Datagrid with first column being a custom itemrenderer with a
> >> > check box, a box(to display color) and then a label.
> >> >
> >> > I am using headererRenderer too for that column, but with a check box
> >> and a
> >> > button. The header's check box is used to check\uncheck all items in
> the
> >> > datagrid.
> >> >
> >> > When I click on headererenderer's button or checkbox, the data is
> >> getting
> >> > sorted in the grid. I don't want to do sort when I click on any item
> in
> >> > headerenderer, I want to sort it only when user clicks on header apart
> >> from
> >> > that button and checkbox.
> >> >
> >> > I tried to stop event propogation, but always header release event is
> >> > triggered first than headerrenderer's button or check box click. So
> stop
> >> > propagation wont work.
> >> >
> >> > Is there anyway to avoid sorting on click of headerrenderer item? I'm
> >> using
> >> > Flex 3.6.
> >> >
> >> > Cheers!
> >> >
> >>
> >
> >
>

Re: How to avoid sorting on click of headerrenderer?

Posted by Deepak MS <me...@gmail.com>.
Here's what I'm trying(sample application):


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
minWidth="955" minHeight="600" >

    <mx:Script>
        <![CDATA[
            import mx.utils.ObjectUtil;
            public function
sortStringFunction(totalFieldName:String,totalValue:String,
fieldName:String,  isNumeric:Boolean = false):Function{

                return function(obj1:Object, obj2:Object):int
                {
                    if(obj1[totalFieldName] == totalValue){


                        return 0;

                    }else if(obj2[totalFieldName] == totalValue){


                        return 0;

                    }else{

                        if(isNumeric)
                        {
                            return
ObjectUtil.numericCompare(obj1[fieldName],obj2[fieldName]);
                        }else
                        {
                            return
ObjectUtil.stringCompare(obj1[fieldName],obj2[fieldName],true);
                        }

                    }

                }
            }
        ]]>
    </mx:Script>

    <mx:ArrayCollection id="ac">
        <mx:Object ischecked="true" color="" name="ABC"/>
        <mx:Object ischecked="true" color="" name="KJHD"/>
        <mx:Object ischecked="true" color="" name="ADFDGG"/>
        <mx:Object ischecked="true" color="" name="SDF"/>
        <mx:Object ischecked="true" color="" name="TRF"/>
        <mx:Object ischecked="true" color="" name="DF"/>
        <mx:Object ischecked="true" color="" name="YTU"/>
        <mx:Object ischecked="true" color="" name="Total"/>
    </mx:ArrayCollection>
    <mx:DataGrid dataProvider="{ac}" width="500" height="500"
sortableColumns="true">
        <mx:columns>
            <mx:DataGridColumn sortable="true"
sortCompareFunction="{sortStringFunction('name','Total','name')}">
                <mx:headerRenderer>
                    <mx:Component>
                        <mx:VBox  paddingLeft="5" verticalAlign="middle"
horizontalAlign="left">
                            <mx:Script>
                                <![CDATA[
                                    import mx.controls.Alert;
                                    import mx.events.DataGridEvent;

                                    protected function
checkbox2_changeHandler(event:Event):void
                                    {

                                        /*  event.preventDefault();
                                        event.stopImmediatePropagation();
*/ // this doesn't avoid sorting. I want to avoid default sorting here

                                        for each(var item:Object in
outerDocument.ac)
                                        {
                                            item['ischecked'] =
event.currentTarget.selected;
                                        }

                                        outerDocument.ac.refresh();
                                    }


                                ]]>
                            </mx:Script>

                            <mx:HBox>
                                <mx:Button width="15" height="15"/>
                                <mx:Label text="ATCs" />
                            </mx:HBox>
                            <mx:CheckBox
change="checkbox2_changeHandler(event)" label="Check All" />
                        </mx:VBox>

                    </mx:Component>
                </mx:headerRenderer>

                <mx:itemRenderer>
                    <mx:Component>

                        <mx:CheckBox selected="{data.ischecked}" label="{
data.name}">

                        </mx:CheckBox>

                    </mx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>
        </mx:columns>
    </mx:DataGrid>
</mx:Application>


On Wed, Dec 10, 2014 at 3:24 PM, Deepak MS <me...@gmail.com> wrote:

> Yes, I did. On click of header button, I called those 2 methods but it
> still sorts the column data.
>
> On Wed, Dec 10, 2014 at 3:15 PM, Evyatar Ben Halevi-Arbib <
> evyatarbh@gmail.com> wrote:
>
>> Have you tried using the following calls in your renderer's event handler
>> function?
>> event.preventDefault();
>> event.stopImmediatePropagation()
>>
>> Regards,
>> Evyatar
>>
>> On Wed, Dec 10, 2014 at 11:30 AM, Deepak MS <me...@gmail.com>
>> wrote:
>>
>> > Hey guys,
>> > I have a Datagrid with first column being a custom itemrenderer with a
>> > check box, a box(to display color) and then a label.
>> >
>> > I am using headererRenderer too for that column, but with a check box
>> and a
>> > button. The header's check box is used to check\uncheck all items in the
>> > datagrid.
>> >
>> > When I click on headererenderer's button or checkbox, the data is
>> getting
>> > sorted in the grid. I don't want to do sort when I click on any item in
>> > headerenderer, I want to sort it only when user clicks on header apart
>> from
>> > that button and checkbox.
>> >
>> > I tried to stop event propogation, but always header release event is
>> > triggered first than headerrenderer's button or check box click. So stop
>> > propagation wont work.
>> >
>> > Is there anyway to avoid sorting on click of headerrenderer item? I'm
>> using
>> > Flex 3.6.
>> >
>> > Cheers!
>> >
>>
>
>

Re: How to avoid sorting on click of headerrenderer?

Posted by Deepak MS <me...@gmail.com>.
Yes, I did. On click of header button, I called those 2 methods but it
still sorts the column data.

On Wed, Dec 10, 2014 at 3:15 PM, Evyatar Ben Halevi-Arbib <
evyatarbh@gmail.com> wrote:

> Have you tried using the following calls in your renderer's event handler
> function?
> event.preventDefault();
> event.stopImmediatePropagation()
>
> Regards,
> Evyatar
>
> On Wed, Dec 10, 2014 at 11:30 AM, Deepak MS <me...@gmail.com>
> wrote:
>
> > Hey guys,
> > I have a Datagrid with first column being a custom itemrenderer with a
> > check box, a box(to display color) and then a label.
> >
> > I am using headererRenderer too for that column, but with a check box
> and a
> > button. The header's check box is used to check\uncheck all items in the
> > datagrid.
> >
> > When I click on headererenderer's button or checkbox, the data is getting
> > sorted in the grid. I don't want to do sort when I click on any item in
> > headerenderer, I want to sort it only when user clicks on header apart
> from
> > that button and checkbox.
> >
> > I tried to stop event propogation, but always header release event is
> > triggered first than headerrenderer's button or check box click. So stop
> > propagation wont work.
> >
> > Is there anyway to avoid sorting on click of headerrenderer item? I'm
> using
> > Flex 3.6.
> >
> > Cheers!
> >
>

Re: How to avoid sorting on click of headerrenderer?

Posted by Evyatar Ben Halevi-Arbib <ev...@gmail.com>.
Have you tried using the following calls in your renderer's event handler
function?
event.preventDefault();
event.stopImmediatePropagation()

Regards,
Evyatar

On Wed, Dec 10, 2014 at 11:30 AM, Deepak MS <me...@gmail.com>
wrote:

> Hey guys,
> I have a Datagrid with first column being a custom itemrenderer with a
> check box, a box(to display color) and then a label.
>
> I am using headererRenderer too for that column, but with a check box and a
> button. The header's check box is used to check\uncheck all items in the
> datagrid.
>
> When I click on headererenderer's button or checkbox, the data is getting
> sorted in the grid. I don't want to do sort when I click on any item in
> headerenderer, I want to sort it only when user clicks on header apart from
> that button and checkbox.
>
> I tried to stop event propogation, but always header release event is
> triggered first than headerrenderer's button or check box click. So stop
> propagation wont work.
>
> Is there anyway to avoid sorting on click of headerrenderer item? I'm using
> Flex 3.6.
>
> Cheers!
>