You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mark goldin <ma...@gmail.com> on 2013/07/15 17:23:36 UTC

Activate a cell for editing

I am working on data editing in Spark dataGrid. Trying to come up with a
solution where I can use selectionMode="none" but still be able to activate
editing in a cell.

Thanks

Re: Activate a cell for editing

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Mon, Jul 15, 2013 at 11:17 AM, Jesse Ward-Karet <jw...@tanium.com> wrote:

> I haven't done much with Spark data grid. In a Spark list, you just create
> a custom item renderer and set 'autoDrawBackground' to false. If you want
> to handle any of the various selection states you can add them to your
> ItemRenderer.
>
> I actually don't do it that way anymore myself. I found I wanted more
> separation between item renderer and look/feel, so I created a class:
>
> public calls SkinnableItemRenderer extends SkinnableComponent implements
> IItemRenderer, IDataRenderer
>
> This allows me to create standard spark skins for my item renderer classes.
>
> It is basically a copy of spark.components.supportClasses.ItemRenderer
> with support for autodrawbackground removed. In replacement, it
> instantiates an InteractionStateDetector on creation and whenever the
> interaction state changes it calls invalidateRendererSkin().  In
> invalidateRendererSkin(), make sure to invalidateSkinState(), and in
> getCurrentSkinState(), you can use the state detector to check for the OVER
> state.  My getCurrentSkinState() supports all the 'built in' states, i.e.
> dragging, selectedAndShowsCaret, hoveredAndShowsCaret... etc.
>
> I have another class, SkinnabledEditableItemRenderer that extends the
> available states to include editing states.
>
> Hope that helps.
>
>
This is a pretty good approach as well.  Except for Spark DataGrid, you
will want extend the GridItemRenderer component.  This component gives you
access to the Grid related properties.



>
> On Jul 15, 2013, at 10:33 AM, OmPrakash Muppirala <bi...@gmail.com>
> wrote:
>
> > One way to do it is to attach a selectionChanging event handler to the
> > Spark Datagrid.  In that handler, simply call event.preventDefault()
> >
> > Please keep in mind that there may be other side effects to doing this,
> so
> > consult the documentation [1] before trying this :-)
> >
> > Thanks,
> > Om
> >
> > [1]
> >
> http://flex.apache.org/asdoc/spark/components/DataGrid.html#event:selectionChanging
> >
> > On Mon, Jul 15, 2013 at 10:01 AM, mark goldin <ma...@gmail.com>
> wrote:
> >
> >> How do I do "disable auto drawing of the selected/hover states"?
> >>
> >>
> >> On Mon, Jul 15, 2013 at 11:41 AM, Jesse Ward-Karet <jw...@tanium.com>
> wrote:
> >>
> >>> Why not allow selection but just disable auto drawing of the
> >>> selected/hover states? Then use an editable item renderer.
> >>>
> >>> On Jul 15, 2013, at 8:23 AM, mark goldin <ma...@gmail.com>
> wrote:
> >>>
> >>>> I am working on data editing in Spark dataGrid. Trying to come up with
> >> a
> >>>> solution where I can use selectionMode="none" but still be able to
> >>> activate
> >>>> editing in a cell.
> >>>>
> >>>> Thanks
> >>>
> >>
>
>

Re: Activate a cell for editing

Posted by Jesse Ward-Karet <jw...@tanium.com>.
I haven't done much with Spark data grid. In a Spark list, you just create a custom item renderer and set 'autoDrawBackground' to false. If you want to handle any of the various selection states you can add them to your ItemRenderer.

I actually don't do it that way anymore myself. I found I wanted more separation between item renderer and look/feel, so I created a class:

public calls SkinnableItemRenderer extends SkinnableComponent implements IItemRenderer, IDataRenderer

This allows me to create standard spark skins for my item renderer classes.

It is basically a copy of spark.components.supportClasses.ItemRenderer with support for autodrawbackground removed. In replacement, it instantiates an InteractionStateDetector on creation and whenever the interaction state changes it calls invalidateRendererSkin().  In invalidateRendererSkin(), make sure to invalidateSkinState(), and in getCurrentSkinState(), you can use the state detector to check for the OVER state.  My getCurrentSkinState() supports all the 'built in' states, i.e. dragging, selectedAndShowsCaret, hoveredAndShowsCaret... etc. 

I have another class, SkinnabledEditableItemRenderer that extends the available states to include editing states.

Hope that helps.


On Jul 15, 2013, at 10:33 AM, OmPrakash Muppirala <bi...@gmail.com> wrote:

> One way to do it is to attach a selectionChanging event handler to the
> Spark Datagrid.  In that handler, simply call event.preventDefault()
> 
> Please keep in mind that there may be other side effects to doing this, so
> consult the documentation [1] before trying this :-)
> 
> Thanks,
> Om
> 
> [1]
> http://flex.apache.org/asdoc/spark/components/DataGrid.html#event:selectionChanging
> 
> On Mon, Jul 15, 2013 at 10:01 AM, mark goldin <ma...@gmail.com> wrote:
> 
>> How do I do "disable auto drawing of the selected/hover states"?
>> 
>> 
>> On Mon, Jul 15, 2013 at 11:41 AM, Jesse Ward-Karet <jw...@tanium.com> wrote:
>> 
>>> Why not allow selection but just disable auto drawing of the
>>> selected/hover states? Then use an editable item renderer.
>>> 
>>> On Jul 15, 2013, at 8:23 AM, mark goldin <ma...@gmail.com> wrote:
>>> 
>>>> I am working on data editing in Spark dataGrid. Trying to come up with
>> a
>>>> solution where I can use selectionMode="none" but still be able to
>>> activate
>>>> editing in a cell.
>>>> 
>>>> Thanks
>>> 
>> 


Re: Activate a cell for editing

Posted by OmPrakash Muppirala <bi...@gmail.com>.
One way to do it is to attach a selectionChanging event handler to the
Spark Datagrid.  In that handler, simply call event.preventDefault()

Please keep in mind that there may be other side effects to doing this, so
consult the documentation [1] before trying this :-)

Thanks,
Om

[1]
http://flex.apache.org/asdoc/spark/components/DataGrid.html#event:selectionChanging

On Mon, Jul 15, 2013 at 10:01 AM, mark goldin <ma...@gmail.com> wrote:

> How do I do "disable auto drawing of the selected/hover states"?
>
>
> On Mon, Jul 15, 2013 at 11:41 AM, Jesse Ward-Karet <jw...@tanium.com> wrote:
>
> > Why not allow selection but just disable auto drawing of the
> > selected/hover states? Then use an editable item renderer.
> >
> > On Jul 15, 2013, at 8:23 AM, mark goldin <ma...@gmail.com> wrote:
> >
> > > I am working on data editing in Spark dataGrid. Trying to come up with
> a
> > > solution where I can use selectionMode="none" but still be able to
> > activate
> > > editing in a cell.
> > >
> > > Thanks
> >
>

Re: Activate a cell for editing

Posted by mark goldin <ma...@gmail.com>.
How do I do "disable auto drawing of the selected/hover states"?


On Mon, Jul 15, 2013 at 11:41 AM, Jesse Ward-Karet <jw...@tanium.com> wrote:

> Why not allow selection but just disable auto drawing of the
> selected/hover states? Then use an editable item renderer.
>
> On Jul 15, 2013, at 8:23 AM, mark goldin <ma...@gmail.com> wrote:
>
> > I am working on data editing in Spark dataGrid. Trying to come up with a
> > solution where I can use selectionMode="none" but still be able to
> activate
> > editing in a cell.
> >
> > Thanks
>

Re: Activate a cell for editing

Posted by Jesse Ward-Karet <jw...@tanium.com>.
Why not allow selection but just disable auto drawing of the selected/hover states? Then use an editable item renderer.

On Jul 15, 2013, at 8:23 AM, mark goldin <ma...@gmail.com> wrote:

> I am working on data editing in Spark dataGrid. Trying to come up with a
> solution where I can use selectionMode="none" but still be able to activate
> editing in a cell.
> 
> Thanks