flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak MS <megharajdee...@gmail.com>
Subject Re: MX DataGrid: How to retain selection?
Date Wed, 21 Jan 2015 08:13:18 GMT
Oops! Not sure how I missed that point in your last email.

Yup! I have now added all 3 listeners and now it works practically too! ;)

Thanks Alex.

On Wed, Jan 21, 2015 at 12:43 PM, Alex Harui <aharui@adobe.com> wrote:

> As I mentioned, you will probably have to stopPropagation mouseDown and
> mouseUp as well.
>
> On 1/20/15, 10:27 PM, "Deepak MS" <megharajdeepak@gmail.com> wrote:
>
> >Let's say, I have selected 2nd row in the datagrid. (so
> >datagrid.selectedIndex = 1 here)
> >
> >Now I click on the check box column of 3rd row. At this point of time, it
> >gets inside cb_clickHandler function of itemrenderer shown below. But even
> >before I call event.stopPropogation() method here, the parent's (which is
> >my datagrid) selectedIndex would have already got updated with value of 2
> >(i.e., 3rd row).  I don't want this selection. I want to retain older
> >selection which is 2nd row.
> >
> >This the my first column's itemrenderer:
> ></mx:HBox>
> >
> >            protected function cb_clickHandler(event:MouseEvent):void
> >            {
> >                //event.stopPropagation(); this doesn't work for me, as
> >the
> >datagrid's selectedIndex would have already got updated with new value.
> >                if(data)
> >                {
> >                    data[checkField] = cb.selected;
> >                    checkEventDispatcher.dispatchEvent(new
> >Event('checked'));
> >                }
> >            }
> >
> >    <mx:CheckBox id="cb" click="cb_clickHandler(event)" />
> >    <mx:Box id="bxColor" width="10" height="10"/>
> >    <mx:Label id="lblDesc" />
> ></mx:HBox>
> >
> >
> >On Tue, Jan 20, 2015 at 11:41 PM, Alex Harui <aharui@adobe.com> wrote:
> >
> >> Where did you try to call stopPropagation?  In theory, having a listener
> >> on the checkbox itself and calling stopPropagation for all mouseDown,
> >> mouseUp, mouseClick should do it.
> >>
> >> On 1/20/15, 12:33 AM, "Deepak MS" <megharajdeepak@gmail.com> wrote:
> >>
> >> >Hi Alex,
> >> >
> >> >Thanks.
> >> >
> >> >I looked into it. But it doesn't allow selection at all.
> >> >
> >> >To make it more clear, this is what I need:
> >> >
> >> >I have a datagrid with first column as checkbox. Rest of the columns
> >>are
> >> >normal ones(text based).
> >> >
> >> >Next, I click on first row(any of the columns, except for the first
> >>column
> >> >which has checkbox) in the datagrid. Hence, first row gets selected
> >> >(highlighted).
> >> >
> >> >Now, I will try to tick on 2nd row using checkbox column. At this
> >>point in
> >> >time, I want to retain the first row's selection.
> >> >
> >> >But if I try to tick on 2nd row's checkbox, 2nd row gets selected. I
> >>want
> >> >to avoid this selection and retain older selection ie., first row.
> >> >
> >> >On Fri, Jan 16, 2015 at 9:18 PM, Alex Harui <aharui@adobe.com> wrote:
> >> >
> >> >> Did you look at various examples of this?  There are two old
> >>variants on
> >> >> my blog:
> >> >>
> >> >>
> >> >>
> >>
> >>
> https://blogs.adobe.com/aharui/2008/02/checkbox_selection_in_datagrid.htm
> >> >>l
> >> >>
> >> >>
> >>
> >>
> https://blogs.adobe.com/aharui/2008/03/custom_ilists_checkboxdatagrid_1.h
> >> >>tm
> >> >> l
> >> >>
> >> >> On 1/15/15, 11:12 PM, "Deepak MS" <megharajdeepak@gmail.com>
wrote:
> >> >>
> >> >> >Hi Guys,
> >> >> >I have a mx datagrid in which I have first column as checkbox.
If
> >> >>there is
> >> >> >a row selection (clicking on any of the row in datagrid), I need
to
> >> >>retain
> >> >> >this row selection when check box is checked. How do i do it? On
> >>check
> >> >>box
> >> >> >'change' event, I tried to stop event propogation, but this isn't
> >> >>working.
> >> >> >On check box change, datagrid's selected index would get changed
> >> >>already
> >> >> >even before I can try something. How can I avoid this behavior?
> >> >> >
> >> >> >thanks.
> >> >>
> >> >>
> >>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message