Return-Path: X-Original-To: apmail-flex-users-archive@www.apache.org Delivered-To: apmail-flex-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D3668109D0 for ; Wed, 17 Jul 2013 17:55:12 +0000 (UTC) Received: (qmail 3479 invoked by uid 500); 17 Jul 2013 17:55:12 -0000 Delivered-To: apmail-flex-users-archive@flex.apache.org Received: (qmail 3463 invoked by uid 500); 17 Jul 2013 17:55:11 -0000 Mailing-List: contact users-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@flex.apache.org Delivered-To: mailing list users@flex.apache.org Received: (qmail 3453 invoked by uid 99); 17 Jul 2013 17:55:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jul 2013 17:55:11 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of markzolotoy@gmail.com designates 209.85.220.182 as permitted sender) Received: from [209.85.220.182] (HELO mail-vc0-f182.google.com) (209.85.220.182) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jul 2013 17:55:07 +0000 Received: by mail-vc0-f182.google.com with SMTP id id13so1617758vcb.27 for ; Wed, 17 Jul 2013 10:54:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=KIOmxNqc9BKmNVFvqtW1H4xWJSbWfq2Ouc1Yjjk5Xh4=; b=EeRXhyFoADA00orxWQiO0v+gk7uWgThNLl5soG8CaffBWjty1s3CfPQTYoabhuBc9e KEaeOBcD94yo9eS/iqDjbWFoml522IZHesroFc3UNMsVSAInEjQpfIHn+oCqqVOGEjOo 5H0yiHCCFmX+EvJsNwibzGzY419I0429TGzOddb64qfGZmxtlLHbni9LmpZdjzgbJJOm Ckx+4NwgNaYYR23AoPH3nMD+Zncj3nKh6QmyEC4DdNKmjqvRm//HEvJHGuPC+5EYjBcL ChIohMerYm2WIUsQwlJz1o3sys6smI2yz41jKuGoaaHq60Laaevei+dNAI5uXbaKGK71 mwdA== MIME-Version: 1.0 X-Received: by 10.52.32.133 with SMTP id j5mr2087324vdi.103.1374083686446; Wed, 17 Jul 2013 10:54:46 -0700 (PDT) Received: by 10.58.199.105 with HTTP; Wed, 17 Jul 2013 10:54:46 -0700 (PDT) In-Reply-To: References: Date: Wed, 17 Jul 2013 12:54:46 -0500 Message-ID: Subject: Re: Spark DataGrid rendererIsEditable From: mark goldin To: users Content-Type: multipart/alternative; boundary=bcaec51d2e5405bddd04e1b8ca44 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec51d2e5405bddd04e1b8ca44 Content-Type: text/plain; charset=ISO-8859-1 After I removed rendererIsEditable my renderer works both ways - rendering and editing. So, no more of that problem. On Wed, Jul 17, 2013 at 12:29 PM, Jesse Ward-Karet wrote: > I wouldn't say this is the best coding style (not the way I do it anymore), > but here is an old editable item renderer I created for a Spark list. > You'll need to update it slightly to make it work with the data grid item > renderer > > > xmlns:s="library://ns.adobe.com/flex/spark" > xmlns:mx="library://ns.adobe.com/flex/mx" > autoDrawBackground="true"> > > > import mx.core.UIComponent; > > import spark.components.supportClasses.ListBase; > > [Bindable] private var editing:Boolean = false; > [Bindable] public var promptText:String = ''; > [Bindable] public var restrict:String; > [Bindable] public var maxChars:int = 0; > > [Bindable] private var labelText:String; > > private function onChange(event:Event):void > { > var oldValue:String = labelText; > var list:ListBase = this.owner as ListBase; > > labelText = inputTxt.text; > > if (oldValue != labelText) > { > if ( data.hasOwnProperty('label') ) > { > data.label = labelText; > } > else > { > data = labelText; > } > > //dispatch the data update event > > list.dataProvider.setItemAt( data, itemIndex ); > > list.dataProvider.itemUpdated(list.dataProvider.getItemAt(itemIndex)); > } > editing = false; > > list.setFocus(); // make keyboard navigation work > } > > public function doEdit(event:Event = null):void > { > editing = true; > inputTxt.text = data.hasOwnProperty('label') ? data.label : > data as String; > inputTxt.selectRange(0,inputTxt.text.length); > inputTxt.setFocus(); > } > > ]]> > > > > /> > > > > doubleClickEnabled="true" > text="{labelText != '' ? labelText : promptText}" > fontStyle="{labelText != '' ? 'normal' : 'italic'}" > doubleClick="doEdit(event)" > visible="{!editing}" > top="7" bottom="5" left="5" right="3"/> > > visible="{editing}" > focusOut="onChange(event)" > enter="onChange(event)" > restrict="{restrict}" > maxChars="{maxChars}" > top="2" bottom="2" left="2" right="2" minWidth="25"/> > > > > > On Wed, Jul 17, 2013 at 5:13 AM, mark goldin > wrote: > > > I am trying to use an item renderer as an editor. Here is my renderer > code. > > > > > xmlns:s="library://ns.adobe.com/flex/spark" > > xmlns:mx="library://ns.adobe.com/flex/mx" > > xmlns:gridEditorClasses="spark.components.gridEditorClasses.*" > > > > > > > > import spark.events.TextOperationEvent; > > override public function set data(value:Object):void > > { > > super.data = value; > > if (data) > > { > > Comment.text = data[column.dataField]; > > } > > } > > protected function commentChange(event:TextOperationEvent):void > > { > > data[column.dataField] = event.target.text; > > } > > ]]> > > > > > > > > > paddingBottom="10" width="100%" change="commentChange(event)" > > fontSize="{column.grid.dataGrid.getStyle('fontSize')}" paddingLeft="10" > > selectionHighlighting="whenFocused"/> > > > > > > > > What's happening is that as soon as I enter one character the editing > > session is over and I need to click on the cell again to start editing > > process. > > > > Thanks > > > --bcaec51d2e5405bddd04e1b8ca44--