Editing a current item of an arrayCollection

Seemed pretty intuitive but I guess I've not done it before in this way. I have a collection of divisions (sports divisions in a league) in an arrayCollection. To edit info for any division, I use a dropdown list that has a dataProvider of the array collection using the name field as the label field. That works fine the first time but when I drop down the list for the second time, it actually updates the current division with the new division info that's being instantiated.
That sounds difficult to visualize.
I have a form called DivisionForm with fields populated by [Bindable] model.currentDivision
I have a manager that acts as the model which injects the values for divisions and currentDivision into the form.
When I change the dropdown item, it dispatches an event to the manager which says, in short, currentDivision = divisions.getItemAt[dropDown.selectedItemIndex]
So that's not really how it works but conceptually that's what's happening. But when I try to change out the currentDivision, it actually updates by reference the old item.
So, let's say I  start with an arraycollection of
softball
baseball
tball
and the currentDivision is softball in the form. When I dispatch the event, the manager gets the message fine and the function is (simplified)
public function changeCurrentDivision(e:DivisionEvent):void {
            var division:Division = e.division;
           currentDivision = e.division
so now I have
baseball
baseball
tball
I understand the concept of both pointing to the same arrayCollection but I can not figure out how to simply say set the form elements with the currentDivsion being baseball, don't update the existing currentItem reference in the arrayCollection. I've tried making currentDivision a deep copy of the original object within the arrayCollection but no go. What simple principle am I missing here? The only ways I've been successful are way too verbose and obviously stupid so I'm looking for the right way ;-)

My solution doesn't feel ideal but maybe it will elicit suggestions regarding a better way to handle it. Essentially, I have an array collection of custom objects related to a sports league. I bind one of those, say division[2] to a construct called currentDivision and that division objects to fields in a form and had bindings to specific properties like {currentDivision.name} . I could update the current item but then when I would change the dropDownList to select another division, and through a manager had the value for currentDivision bind to, let's say, division[4] as the new currentDivision, division[2] would be populated by division[4]. Obviously, the reference was a pointer that was telling flex to change currentDivision [2] to the values for division[4] rather than start fresh with a new object. My hunch is there's a way to properly edit that object using the dp.source but I haven't hit on the right search terms yet for my friend Google. So instead I decided to make a copy of the division[2] to populate the editing form so that it was divorced from the actualy dataCollection. To do that I had to make a deep copy of the division object, which involved a couple of things. I created a little class because I knew I was going to be doing this a lot that was a copier.
    public class DeepCopy {
        import mx.utils.ObjectUtil;
        public function DeepCopy() {
        public static function copyLO(item:Object):Object {
            var myCopy:Object=ObjectUtil.copy(item);
            return myCopy;
but this copies all the properties as generic objects so I also had to modify my division object with some metadata. So the division class looked something like:
package com.cactusware.model {
    import mx.utils.UIDUtil;
    import mx.collections.ArrayCollection;
    [Bindable]
    [RemoteClass(alias="com.cactusware.model.Division")]
    public class Division {
        private var _Guid:String;
        private var _name:String;
        private var _shortCode:String;
        private var _longCode:String;
        private var _notes:String;
        private var _customCodes:ArrayCollection;
        public function Division() {
            Guid = UIDUtil.createUID();
        public function get Guid():String {
            return _Guid;
..... and so forth.
Now in my app I could make a copy that was pretty divorced from the actual dataprovider.
var newDivision:Division = DeepCopy.copyLO(currentDivision) as Division;
At least those are the principles summarized.
Now hopefully one of the gurus will tell us how to do this without going through all the gyrations, assuming they understand the problem we're having.
John

Similar Messages

  • Is there a way go get the item number of the current item?

    In an item with multiple instances: Is there a way to get the item number of the current item? If for instance, I am on the 3rd item, is there some kind of “GET CURRENT RECORD NUMBER” built-in that would return a ‘3' to the program?
    Thanks
    Edited by: WayneFMcKinstry on Apr 9, 2010 10:50 AM

    If i am getting you correctly that in tabular item you want to know the current record or current item you can try this...
    For current record
    :SYSTEM.CURSOR_RECORD;
    or
    :SYSTEM.CURRENT_RECORD;for current item
    :SYSTEM.CURSOR_ITEM;-Ammad

  • Update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow

    Hi,
    We have a requirement to update a column value once the item has been approved.
    Following settings have been made in the publishing articles list:
    Require content approval for submitted items : yes
    Create major and minor (draft) versions
    Who should see draft items in this document library? :Only users who can edit items
    Require documents to be checked out before they can be edited? : yes
    I have createdatu a Sharepoint 2013 workflow to check if Approval sts of current item = 0 i.e. Approved , then check out and update the item and finally checkin the item. Everything works fine till this point except that the minor version of the item is
    checked in. Due to this the updated columns are not published to others.
    Also, I created a Sharepoint 2010 workflow to SET CONTENT APPROVAL = APPROVED and started this workflow from my list workflow above, but the item does not get checked-in and always shows "In Progress" status with comment "The item is currently
    locked for editing. Waiting for item to be checked in or for the lock to be released.".
    Please let me know where I am missing out so that once the item is approved, column value gets updated and current item is still in Approved status.
    Thanks

    Hi,
    According to your post, my understanding is that you want to update Column value after current item is Approved and then publish major version using Sharepoint 2013 designer workflow.
    You will get into this kind of Catch-22 situation trying to set the Content Approval Status in SharePoint Designer workflow:
    - You must check out the document before you can change the Content Approval Status
             - You can't change the Content Approval Status once the document in checked out
    Since you set the Require documents to be checked out before they can be edited=Yes, you will need to check out the document when run the workflow on the item. But you cannot approve a document when it is checked
    out. So the logic in workflow conflicts.
    As a workaround, you can use the Start Another Workflow action to start the normal Approval workflow on the document.  The built-in Approval workflow can work with a document that’s not checked out.
    The designer approval workflow also can work with a document that’s not checked out.
    You can create two workflow using SharePoint Designer 2013.
    First, create a SharePoint 2010 platform workflow.
    Then, create a SharePoint 2013 platform workflow.
    Then when the SharePoint 2013 platform workflow start, it will start the SharePoint 2010 platform workflow to set content approval status, then the SharePoint 2013 platform workflow will update current item value.
    More information:
    SharePoint Designer Workflow Content Approval Issue
    SharePoint 2010 Approval Workflow with Content Approval
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Change visual_attribute on current item at block level

    Hello everybody.
    Is there anyway to apply visual_attribute on current item at block level ? Explanation: i have block with a lot of items, so it's really hard to create many POST-TEXT-ITEM triggers on every item and apply visual_attribute on it...
    Thx in advance.
    Adnan
    Edited by: adnanBIH on Dec 7, 2009 11:38 AM

    Hi,
    You can set the visual attribute using the following as per your requirement:
    This is for item instance
    Set_Item_Instance_Property( 'Your item', CURRENT_RECORD, VISUAL_ATTRIBUTE,'Custom_attribute'); for item
    Set_Item_Property( 'Your item', VISUAL_ATTRIBUTE,'Custom_attribute'); regards
    knick
    Edited by: knick on Dec 7, 2009 10:46 AM

  • Error while editing a list item - SharePoint 2010.

    Hi ,
    i have 2 site collection one is read only site and another one is authoring site. both site collection are inside single web application and referring same content database.
    when i try to edit a list item using authoring site i am getting the below error message. this is for all the lists in the site.
    " the item is no longer available. it may have been deleted by another user. click ok to refresh the page."
    i am able to edit the list items using read only site as an administrator.
    please help me on these.

    This could be a permission issue, refer to the following post for more information
    http://techtrainingnotes.blogspot.in/2012/02/sharepoint-error-this-item-is-no-longer.html
    Cheers,

  • Shortfall of 85 days against SLED in current item

    Dear Masters
    while doing goods receipt for some of materials it troughing an error like
    Shortfall of 85 days against SLED in current item, may be this is due to batch expiry.
    so how to rectify this.

    Check the batch search strategy settings in t.code MBC2. May be this setting, is providing this message. If so then change the data regarding SLED check and then try to do the goods receipt again.
    Regards,

  • List data validation failed when creating a new list item but does not fail when editing an existing item

    Dear SharePoint Experts,
    Please help.
    Why does my simple formula work in Excel but not-work in SharePoint?
    Why does this formula...
    =IF([Request Type]="Review",(IF(ISBLANK([Request Date]),FALSE,TRUE)),TRUE)
    ...work in Excel but fail when I try to use it in SharePoint?
    The intent of this formula is the following...
    If the field "Request Type" has the value "Review" and the field "Request Data" is blank then show FALSE, otherwise show TRUE.
    SharePoint saves the formula, but when a list item is saved where the formula is implemented, (under List Settings, List Validation), SharePoint does not, say anything other than that the formula failed.
    Note that the "list data validation failed" error only happens when I am creating a new item-- the formula above works just fine when one is trying to Save on the edit form. 
    Can you help?
    Thanks.
    -- Mark Kamoski

    Dear Jason,
    I appreciate your efforts.
    However, it seems to me that this statement of yours is not correct...
    "If it meet the validation formula, then you can new or edit the item, otherwise, it will throw the 'list data validation failed' error, it is by design".
    I believe this is NOT the answer for the following reasons.
    When I create a new item and click Save, the validation error is "list data validation failed".
    When I edit an existing item and click Save, the validation error is "my custom error message" and this is, I believe, the way it needs to work each time.
    I think, at the core, the error my formula does not handle some condition of null or blank or other default value.
    I tried a forumla that casts the date back to a string, and then checked the string for a default value, but that did not work.
    I tried looking up the Correlation ID in the ULS when "list data validation failed" occurs, but that gave no useful information because, even though logging was set to Verbose, the stack trace in the error log was truncated and did not given any
    good details.
    However, it seems to me that SharePoint 2013 is not well-suited for complex validation rules, because...
    SharePoint 2013 list-level validation (NOT column-level validation) allows only 1 input for all the multi-field validation formulas in a given list-- so, if I had more than 1 multi-field validation rule to implement on a given list, it would need to be packed
    into that single-line-of-code forumla style, like Excel does. That is not practice to write, debug, or maintain.
    SharePoint 2013 list-level validation only allows 1 block of text for all such multi-field validation rules. So that will not work because I would have something like "Validation failed for one or more of the following reasons-- withdrawal cannot exceed
    available balance, date-of-birth cannot be after date-of-death,... etc". That will not work for me.
    The real and awesome solution would simply be enhancing SP 2013 so that column-level validation forumlas are able to reference other columns.
    But, for now, my workaround solution is to use JavaScript and jQuery, hook the onclick handler on the Save button, and that works good. The only problem, is that the jQuery validation rules run before any of the column-level rules created  with OOTB
    SP 2013. So, in some cases, there is an extra click for the enduser.
    Thanks,
    Mark Kamoski
    -- Mark Kamoski

  • Visual attribute for current item

    How can i set the visual attribute of the current item in multi block form so that when user navigate through item in a form its background colour is changed and user can easily trace where the cursor is ?

    1- I have three list box on the form as well so whether post-text-item works over therei have no issues with this and it is working fine in my forms list box
    2- and i have 3 datablock among which 2nd and thid datablock is multirecord datablock where i set current record visual attribute so what is the behaviour @ run time either current record Visual attribute override current item VA or it works fine
    it is working perfectly in multi record also..you need to remember in post text trigger use the same visual attribute used for current record visual attribute

  • HTML Code for Smart Link Edit and Logout items

    I am using an HTML template and would like to include the Smart Link Edit and Logout items in a TABLE. How do I do this?
    Is there a way to get the code for these Smart Links (ORACLE tags) and include them?

    According to Oracle Metalink "Note:368720.1 - When ILS is Enabled the Edit Smartlink is visible to Users that are not entitled to see it", that is the expected behavior whether you are using the "edit" substitution tags or the "edit" smartlink on a page when the page has item-level access enabled. I don't like it but I can understand why that is the behavior since an end user may have access to manage/edit just one item on a page or just one tabbed region on a page and they need a way to put the page into edit mode in order to edit their item(s). If a user has nothing to edit on a page, then they won't be able to do anything in edit mode anyway.
    On the employee portal I work on, there is the possibility that every page may have a different set of users/groups that need to edit items/regions on the page AND the edit smartlink is published on the portal page template so basically, all employees can see the Edit link but if they click on it, only those employees that have items/regions to edit/manage will be able to really do anything while in edit mode.
    However, on the customer portal I work on, there is only one group that manages content site-wide so I was able to publish the Edit smartlink on the portal page template and change its access to the one group that manages content so they're the only ones that can see the Edit link on every page.
    The substitution tags for Logout are #PORTAL.LOGOUT.URL# and #PORTAL.LOGOUT.LABEL# (I use those so I can control the html & css) or just #PORTAL.LOGOUT# (which does both the label and url). The list of all substitution tags is available in Oracle Application Server Portal Help.

  • Changing the color of the current item in a link bar

    It seems that the currrent item and the disabled color are
    the same. How can I have the current item stand out in a link bar?
    I see styles for Selected but not for the current item.
    thanks
    bruce

    I tried with keylistener but it is not working.What is not working, the KeyListener or the coloring of cells? Don't make us guess.
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
    Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting.

  • Current item Background Color

    Hello Friends,
    I am facing some problem in changing the bachgroud color of the selected field in block,
    Basically i want to make visible the current field in a record,not the enire record but just the current item.
    thanks to all;

    Create WNII and POST-TEXT-ITEM triggers (block level) with command
    Set_Item_Instance_Property(:SYSTEM.CURRENT_ITEM, CURRENT_RECORD, VISUAL_ATTRIBUTE, <VA_NAME>);
    Note! Current record VISUAL ATTRIBUTE of block must be <NULL>.

  • OK! I am unable to type into any pages documents ... just started doing this. Tried opening new page ... no luck ... thries to edit a current paper... no luck!!! Help, anyone have an idea what I have done?

    OK! I am unable to type into any pages documents ... just started doing this. Tried opening new page ... no luck ... thries to edit a current paper... no luck!!! Help, anyone have an idea what I have done?

    Try a new post in the Pages forum. They would know better then us.
    DALE

  • Error-Cannot set DISPLAYED attribute of the current item DUMMY.VIEW

    HI ALL,
    Im my form, I have three BLOCKS
    1) CTL(Manual Data Block)
    2) DUMMY(Manual Data Block)
    ITEMS 1) msg 2) <view> 3) <cancel> 4) <Exit>
    3) Audit Trial Log(Database Data Block)
    ITEMS All Database columns of a table Audit_Trial_Log
    CANVASES 1) CANVAS3------Block CTL---window1
    2) New_Entries---Blocks Dummy and Audit Trial Log--New_Entries
    In CTL block I have button <VIEW>. On when-Button-Pressed trigger I am setting "VISIBLE' properties false for items of datablock AUDIT Trail LOG and also for item of datablock DUMMY excluding for <VIEW> and <Cancel> buttons.
    when-Button-Pressed trigger of <View>, I have done reverse setting i.e. previously visible items to invisible and vice versa. Also I am executing query on Audit Trial Log block. But when I click <VIEW> I get the following error
    FRM-41016: Cannot set DISPLAYED attribute of the current item DUMMY.VIEW Even execute query fails.
    Please help me......

    before setting a current item to invisible you must navigate to another item, which is visible

  • Problem with current item in forms 9i

    I call form from another form the first time the form runs correctly, but if I close it and re-open it again, when I tried to move the cursor to any item in the form using the mouse, the cursor moves correctly but when I need to get the current item value using ':system.cursor_value' then the cursor returns to the first item and get the value from the first item. This problem only with the mouse. But if I move to the item-using keyboard there is no problem.

    979801 wrote:
    If I use LOV in place of List Item,Then I have to populate a LOV at run time.How could I maintain a record group n attach to LOV at run time?
    On my previous post I have mentioned record group as follows:
    select * from tbl_state where s_id=:tbl_address.s_id;
    If :tbl_adress.s_id chaned during the time of run, then output values of list_city (LOV) is also changed.

  • Shortfall of 181 days against remaining shelf life in current item(18Month)

    Hi All,
             When performing a GR for PO, where purchase info record was maintained with minimum remaining shelf life of 18 M. On performing the GR, system throws up an error message 'Shortfall of 181 days against remaining shelf life in current item(18Month)', when the production date was entered 07/27/2009. What does this error message mean and how is the 181 days calculated ?
    Regards,
    PSS

    >
    PSS wrote:
    >When performing a GR for PO, where purchase info record was maintained with minimum remaining shelf life of 18 M. On performing the GR, system throws up an error message 'Shortfall of 181 days against remaining shelf life in current item(18Month)', when the production date was entered 07/27/2009. What does this error message mean and how is the 181 days calculated ?
    First understand concept of minimum remaining shelf life.
    Minimum shelf life does not has direct relation with info record. It comes from/ system calculate it based on Material master --> Plant data/ storage 1 --> Field name: "Minimum rem. shelf life". It shows - Minimum amount of time for which the material must keep upon GR for the goods receipt to be accepted by the system.
    In Material master --> Plant data/ store 1 --> Field name: "Total shelf life".  It shows - "Period for which the material will keep in total, that is, from the date of production to the shelf life expiration date"
    Now at the time of GRN once you enter Date of manufacture then base on material master --> total shelf life system will calculate "SLED/ BBD".
    Based on this calculation system through this message of "shortfall of 181 days".
    If you still have confusion please let me know what you have entre in material master --> for minimum rem. shelf life & total shelf life. So I can reply you with exact calculation.
    Hope this helps.
    Thanks!!!

Maybe you are looking for

  • Issue with OBIEE 11g(11.1.3) Installation

    I have installed OBIEE 11g last evening. I was able to connect to the dashboard and run a simple report also – all before shut down. Now when I try to access OBIEE 11g thru port :9704 after starting the BI services, I am getting the following error.

  • Windows 8--"iTunes64Setup" (11.1.3) will not run/install

    Hi all, I received an iPad air for Christmas today, and naturally I plugged it into my laptop (a Sony Vaio, running Windows 8.0) in order to access iTunes (we do not have wi-fi at home).  My laptop, which at the time was running iTunes 11.0.5 (I beli

  • Windows doesn't see my iPod, nor does iTunes

    The iPod 3d is just dead, and it doesn't appear on My Computer or on iTunes, and it won't even turn on. I have had it charged for a long time, both on the computer and at an electric outlet. I get an error message on iTunes that says it detects an iP

  • Need Concept Help for a game

    OK, I'm wanting to make one of those games where you have a big matrix of circles, and if you click on one that'd adjacent to 2 or more of it's same color, you can remove it. I'm wondering what object I should use for those circles. I'm thinking I co

  • Problem with Oracle Form Function

    Hi All, I have built different forms Custom In Oracle Financials, but when I click in the menu option this error appears "Function not available to this responsability. Change responsibilities. or contact your System Administrator". So I can't see th