Difficulty to remove the element of ArrayDataModel in DeleteActionItem

Hello

I have a ListView that is filled with an ArrayDataModel. When I add data to the ArrayDataModel, it works very well. But when I want to delete a data model element in a DeleteAction I get the following error:

asset:///Main.qml:112: ReferenceError: Can't find variable: theDataModel

Here is my code:

import bb.cascades 1.2
import bb.cascades.pickers 1.0
import bb.data 1.0

import myApplicationData 1.0

NavigationPane {
    id: navigationPane

    onCreationCompleted: Qt.app = app

    Page {

        content: Container {

            ListView {
                id: listview
                objectName: "listview"

                dataModel: ArrayDataModel {
                    id: theDataModel

                    property bool empty: true

                    onItemAdded: empty = isEmpty()
                    onItemRemoved: empty = isEmpty()
                    onItemUpdated: empty = isEmpty()
                    onItemsChanged: empty = isEmpty()
                }

                // Use a ListItemComponent to determine which property in the
                // data model is displayed for each list item
                listItemComponents: [
                    ListItemComponent {

                        StandardListItem {
                            // Display the value of an item's title property
                            // in the list

                    id: component

                            title: ListItemData.name
                            description: ListItemData.path
                            imageSource: "asset:///images/icon.png"

                            contextActions: [
                                // Add a set of four actions to the context menu for
                                // a list item
                                ActionSet {
                                    title: "Protocol"

                                    DeleteActionItem {
                                        onTriggered: {
                                            component.ListItem.view.dataModel.itemRemoved(component.ListItem.indexPath)
                                            theDataModel.removeAt(component.ListItem.indexPath) <---------------- Here I want to remove the data from theDataModel again but I get the error message: "asset:///Main.qml:112: ReferenceError: Can't find variable: theDataModel"
                                            app.ShowToast("Protokoll wurde gelöscht")
                                            app.ShowToastWithoutButton("Protokoll gelöscht")
                                        }
                                    }
                                } // end of ActionSet
                            ]

                            textFormat: TextFormat.Auto
                            status: ""
                            imageSpaceReserved: true

                        }
                    }
                ]
        } // end of Container

        actions: [
            ActionItem {
                title: "Open"
                imageSource: "asset:///icons/ic_open.png"
                ActionBar.placement: ActionBarPlacement.OnBar

                onTriggered: {
                    filePicker.open()
                }
            }
        ]

        attachedObjects: [
            FilePicker {
                id: filePicker

                property string selectedFile

                mode: FilePickerMode.Picker

                type: FileType.Other
                title: "Open document..."
                viewMode: FilePickerViewMode.Default
                sortBy: FilePickerSortFlag.Default
                defaultType: FileType.Other
                onFileSelected: {

                    selectedFile = selectedFiles[0];

                   *select file and fill it to data model *                    var data = {                                "name": name,                                "path": path,                            }                   theDataModel.append(data);  <-------------- here I append the data to theDataModel
                }
            }
        ]

    }
}

It's the wrong way to access the data model? or how can I remove an item from this data model, when I remove it from the list?

Try,

component "". ListItem.view.dataModel.removeAt

Tags: BlackBerry Developers

Similar Questions

  • FRM-41331 could not remove the element

    Hi all

    I got the error when I am filling the list item...

    Here, I write the query in WHEN BUTTON PRESSED

    
    declare
      vGroupId  varchar2(10);
      vRecGrpId recordgroup := find_group('rg_test');
    begin
      clear_list('BLOCK3.DESCRIPTION');
      vGroupId := populate_group(vRecGrpId);
      clear_list('BLOCK3.DESCRIPTION');
      populate_list('BLOCK3.DESCRIPTION',vRecGrpId);
    end;
    

    I create a record group-> rg_test

    Request: select code, DESCRIPTION of test_list DESCRIPTION order

    If I run the form and press the button on his watch list item values

    My problem is after execution of forms, I inserted the new value in DB, again once I'll push her mistake to see the 'FRM-41331 could not remove the element'

    Please help me I want to fill in the values taken after insertion

    go_field ();

    clear_item;

  • having difficulty to remove the traits of a media element

    I'm having difficulty to remove a dash of a subclass of the LightweightVideoElement.  Depending on the type of video game through the netstream, I want to remove the line to seek to prevent research with chrome scrub bar.

    My problem is that when I delete the line of the element of the hasTrait method is always returning true.  To demonstrate that I have add a listener in the constructor of the item as follows:

    addEventListener (MediaElementEvent.TRAIT_REMOVE, announceTraitRemoved);

    And my function is:

    private void announceTraitRemoved(e:MediaElementEvent):void
    {
    trace ("item-> announceTraitRemoved-> LINE DELETED:" + e.traitType + "hasTrait thus:" + hasTrait (e.traitType));

    }

    The output of the function after the call to removeTrait (MediaTraitType.SEEK) is:

    Item-> announceTraitRemoved-> LINE DELETED: get both hasTrait: true

    He never returns hasTrait: false to the seek feature.

    This is problematic because the Pack chrome ScrubBar determines if the air cleaner is turned on by listening to this event in a similar way and using the hasTrait method, so I can't figure out how to turn off the scrub bar.

    What I am doing wrong?  If it's important, I use 1.0 gm.

    Thank you.

    The ScrubBar must be dimmed if the SeekTrait is not present (i.e. hasTrait == false).  If you use the proxy method I described, it should work as you wish.

  • Having difficulty to remove the adware from my computer

    Yesterday I ran a search in google for winzip password recovery which led me to a website called . www zippasswordrecovery.com /. I have AVG Anti-Virus installed on my computer, so I thought that I was safe to download the file. However, once downloaded AVG detected a threat, so I put in quarantine. Apparently it installed on my computer, and of course annoying adware ads popped up whenever I went through Internet. I went to add or remove programs and found (file name is FREEzeFlip), and every time I try to remove it, my antivirus detects a threat and quarantines, preventing me to spend with the removal process. I did a scan with AVG which found nothing, then installed Malware Bytes, which found 6 threats which were all adware and supposed to be deleted successfully. I restarted my computer, browsed the web, and every time I visit a Web site, Malware Bytes gives the message "successfully blocked access to a potentially dangerous website 64.94.137.96 type: outgoing," I guess that's blocking a pop-up every time ad that appears. I went to add or remove programs and Malware Bytes gave essentially the same message as AVG and quarantine. I googled 'remove FREEzeFlip' and found this Web page with technical support information to remove the FREEzeFlip from the computer: http://webcache.googleusercontent.com/search?q=cache:yvW4QAnD1fYJ:freezeflip.com/support.html+remove+FREEzeFlip&cd=1&hl=en&ct=clnk&gl=us&source= www.google.com (click on text version if it does not load). It is very obvious that it is intentionally malicious because it says "If you continue to see the elements of the FreezeFlip program on your computer after following the steps in uninstalling above, your antivirus software blocks maybe uninstall completely." and that it proceeds then to tell you can uninstall your antivirus software, visit a link to download an uninstall program and restart your computer. LOL... these idiots...

    Thank you in advance for your help! Sorry for the long story, but I didn't leave out the small details that may be important.

    Help, please!

    Hi, use this program to uninstall got rid of him for me,

    http://www.revouninstaller.com/
    I got the link from yahoo answer, good luck
  • How to remove the elements hidden in PDF format

    Hello

    We use Acrobat 11 on Win7 Pro machine. We try to remove the hidden elements of a PDF file, we created.

    Using the image/text editing control we usually change the view to page view mode 2 can then select hidden items and delete them. We do not see the items in the display of the 2 page, but clicking and dragging in the "empty space" in the document, choose which then allows us to manipulate them. These elements are not visible when you view the PDF file normally.

    This time, we have a PDF file where we cannot select an image. We know that it is there, because when you try to trim the visible content, the hidden element is shown:

    crop.jpg

    We want to remove the bars of color at the bottom of the page. Can anyone help us with this, please?

    Thank you!

    I usually use the content pane for this - arrow down through content items and delete the ones I don't want. Not sure that this is the most effective way, just something that I found that works for me. I always work with a copy of the PDF file in case something goes wrong.

    a 'C' student

  • How to remove the element in a scene without deleting the animation of this element

    Hello

    How can I remove an element in a scene (for example to 0:30) without deleting the animation of this element to (for example at 0:20)?

    I don't really know what to do.

    Benno

    Hello

    I have a little trouble to understand what you want. If you want that element disappears in your animation, you can switch the display in two keyframes on the right property before scoring 30 seconds. See below:

    You simply make a keyframe in the position "On" in the display property in the properties panel, then move on to an image and set a new keyframe on 'Off '. This will make invisible if you do not have to remove the animation. : )

    I hope this helps!

  • Difficulty to remove the door of Pavilion g6-1d11dx laptop

    I saw the online service manual, and it says to remove the battery, loosen the two captive screws that fix the door to the computer. I did it. Then I'm supposed to be able to remove the service door. It's not going to.  Then I watched a video for a newer model, and he says to slide the battery release while removing the service door. I did it, push the release of the battery more than all the way, but the back door still won't come out.

    Here is the service manual for your laptop: http://h10032.www1.hp.com/ctg/Manual/c03094202.pdf

    Is there some kind of trick to go out this door?

    Moreover, the screws, but they don't come out. I guess that's why they are called "live captive."

    The reason why I need to open the door: to replace the memory. There may have been a problem of overheating that caused memory to go bad, I'm guessing, but not sure about that. Which would affect opening the back door? I guess overheating, because when I do the memory diagnostic when the computer first starts, it goes. But if I do 10 or 15 minutes later, she fails.

    Hello:

    It is simply difficult to lift the door.

    See this related post... and the other links I posted therein.

    http://h30434.www3.HP.com/T5/hardware-upgrades-replacements/HP-Pavillion-G6-memory-upgrade-problems/m-p/1374715#M6863

  • Having difficulty to remove the Windows Recovery Console

    I followed the instructions on how to do it, but the cmdcons folder could not be deleted. Some files are in use? I installed the recovery yesterday with "Combo Fix" console after having a suspected virus. I wish to remove the console now but could not get the deleted file.

    I followed the instructions on how to do it, but the cmdcons folder could not be deleted. Some files are in use? I installed the recovery yesterday with "Combo Fix" console after having a suspected virus. I wish to remove the console now but could not get the deleted file.

    I recommend that you do not delete it. Recovery Console can be very helpful in situations where you have errors in the file. It works essentially as a back-up allows to replace the files and fix some errors. You can change the amount of time boot options at startup, which speeds up the overall starting your computer. I have mine at 5 seconds. I know what I want to do before I turn on the computer and therefore do not need the options for the default value of 30 seconds.

    I know there are a lot of forums tech that allows you to install Combo instruct. Personally I would never put that on my computer. I've seen too many problems to evolve from it in the past.

    Kind regards

    Joel

    Sometimes to decide what battles to fight the toughest battle of all... Visit my forum @ http://repairbotsonline.forumotion.com/forum.htm

  • difficulty to remove the network wireless to my laptop

    Hi - I'm unable to remove the network my laptop wireless. I have windows Vista Home premium on a Dell Inspiron 1525. I need to delete the list of wireless network in order to re - install (due to changes to the security settings). When I try to remove it, it disappears, but then within 5 seconds it appears again, like a ghost in my computer. Help, please

    Perhaps, he keeps coming back because you're connected to the Internet.

    I assume you mean: network and sharing Center, manage wireless networks, one of the networks on this list, your right you click on the network and clicked on delete network.

    Well, if you click Properties, you can change the security settings.

    If you were logged on to the disconnected from the Internet and then you can remove it and if it works you will see it come back.

    But he will always be there even if you don't see it.

    To remove it completely connect to the Internet with another connection, not one you want to delete.

    Open the network and sharing Center click on customize, click on merge or delete network connections, select the connection that you want to remove and click on delete. This removes the registry.

    If you are unable to connect to the Internet to do this follow these steps:

    Press the Windows Logo key and the R key to open the run.

    type: regedit, click OK

    Navigate to: HKLM/SOFTWARE/Microsoft/Windows NT / CurrentVersion / NetworkList / profiles

    Click on one of the profiles below to view on the right side. Look at the name of the profile to make sure it is the right one.

    When you see one you want to remove a right click the highlighted one on the left side and click on delete.

  • Remove the element-centric validation

    Greetings,

    Is there a way to remove element-centric validation (http://anthonyrayner.blogspot.com/2010/08/apex-40-enhancements-validating-form.html) of APEX 4.0, such as automatic validation of 'hidden' created by entering a certain mask format in a DatePicker element?

    The reason being that I already have a validation for this article, and it stops as some other validation to be executed if one breaks down. So, I don't have the automatic validation.

    Best regards
    Mathieu

    Hi Mathieu,

    What do you mean by "and it stops as some other validation to be executed if one does not? What is related to the automatic validation? Because I just had a quick glance in the code, all automatic and defined validations are manually triggered.

    You have different possibilities to stop the automatic validation for a shooting date picker.

    Set-) 'Perform validation' = 'No' in your submit button that will skip all the automatic, but make sure you set the indicator "always run" in your manual validation.
    Use the classic date picker that does not perform automatic validation of-)
    -) Create your own type of date picker plugin that does not perform automatic validation

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Difficulty to remove the history of web search on hp paviliontx1219usnotebook pc

    Ireceived email on how to delete the history of web search. IF I WROTE IT DOWN CORRECTLY, IT WAS; CLICK START, TYPE FOLDER AND THEN ENTER, DOUBLE-CLICK THE TEMP FOLDER TO OPEN, CLICK CONTROL TO HIGHLIGHT, PRESS DELETE ON THE KEYBOARD, SO PROPTED TRY AGAIN OR JUMP JUMP-CLICK. THIS CAME FROM SPARKS. I TRIED BUT STILL HAVE THE SEARCH HISTORY. I NEED TO GET AUTHORIZED SEARCH HISTORY AS SOON AS POSSIBLE. THIS LAPTOP IS PART OF MY CHURCH. NEED TO READ THE PREVIOUS POST TO UNDERSTAND WHY I TRY TO SEARCH WEB CLEAR HISTORY. Help

    For Firefox, click the orange forefox at the top tab on the left. Select and click on Options. See the following pictures. CClick on the Privacy tab.

    Click clear recent history, select the calendar that you want to remove, and then click OK.

    I recommend that you consider taking a course for new users at your local community college. There will be useful books on the subject at your local bookstore at the Mall in the computer section if you're a quick study.

  • How to remove the elements in the "Deleted items" folder using Microsoft Windows Mail?

    This used to work, but I was not able to remove items from the deleted items folder and it takes a lot of space.  I used to be able to do it and it automatically deletes the items when I closed Windows Mail (it is always set up to do, incidentally, does not yet), but now it does not work. I've tried everything. I used the link at the top of the page coming down and clicked on "Empty Deleted Items Folder", but it does not work.

    I tried to download Windows Live Mail and it won't work on my computer.

    Any help would be appreciated.

    Thank you!

    Maybe could turn the setting and then turn again. Sometimes it works, but I wouldn't be surprised if she did not help, or if you have already tried.

    Take note of the following:

    1. I've never used only 8 years old, Windows Mail
    2. Windows Mail is not supported.

    The deleted items folder has a clean button on it? This can empty it completely. Another thing to consider is that your e-mail service can remove items deleted periodically. However, as you say, it takes place, so you can delete them manually.

    Alternatively, you can consider changing the e-mail programs. You said that Windows Live Mail did not work. You can try an older version, because I don't think not 2012 works on Vista (based on absolutely no evidence, by the way) another option to consider is Mozilla Thunderbird. If you have Microsoft Office and it includes Outlook, certainly use it.

    That's the only advice I have. If this does not help, I don't have anything else for you.

  • The difficulty to remove the transitions with the api

    Hi friendly friends from Adobe.

    I can't remove transitions with the api for creating. I use QE, (simplified loop) thusly:

    app.enableQE ();

    qe.project.getActiveSequence () .getVideoTrackAt (0) .getTransitionAt (0) .remove)

    ... and it works, but there is a leak memory, so I can't run the script twice. I chatted to bbb_999 offline & he suggested that I do not use QE, so now I have this:

    App.Project.sequences [0] .videoTracks [0] .transitions [0]. Unbind (true)

    ... that returns Undefined, and the transition is not removed. I think that I am not by the way of the correct setting in the unbind method. Any help would be appreciated!

    As a matter side: How can I find the list of arguments for methods, because there is no documentation? I get pretty exhausted DOM ExtendScript Toolkit of navigation and then guess what might be the method arguments.

    See you soon,.

    Raphael

    The first method is the right one; Unbind() does not remove a transition. What is the problem of leak memory that you meet?

    > How can I find the list of arguments for methods, because there is no documentation?

    Look in PProPanel and if its use is not exercised here, ask.

    While some screen movie tutorials are being developed, no additional documentation is currently scheduled. If all goes well, a comforting thought; There are > 140 panels in the wild, and none of them had more documentation do you.

  • How can I safely remove the elements of the file to download.

    can I drag items of the file downloaded in the trash?

    Yes, you can.

    (143802)

  • Recorded TV causes Media Center to stop when the cursor is moved over the icon. Sometimes Blue Screen of Death. How can I remove the element from the list of recorded TV shows?

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    "This problem that I've seen before - corrupted metadata in a recorded TV file causes MC to Issac when you click on" show in the list.
    And, it is useful to know that show is the cause.  :)
    Solution: Close Media Center.  Open an Explorer window and go to C:\Users\Public\Recorded TV.  Find the offending file, and either move it to another folder (unless it is a 'protected' program, you can always watch it in Media Player), or delete.
    The file name format is: showname_network_starttime(where starttime is presented as dd_mm_yyyy_hh_mm_ss (24hours). wtv)

    HTH,
    Chris

    MS - MVP (Media Center) [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.]

Maybe you are looking for

  • 9.3.1 iOS used to install on the iPhone 6

    I tried several times to install the new ios and it won't work.  It downloads the update well and then goes through the installation process but comes back with an error: "cannot install update.» Year error occurred installing iOS 9.3.1. "" Try again

  • 555 5.5.2 syntax when sending mail error

    Hi, I use a gmail account via my Chaos Intellect mail server and have followed the instructions here http://www.chaossoftware.com/support/detail.aspx?itemnum=321250 When I test the connection, it says it is successful, and I received emails successfu

  • App remote control PS3

    Hello world.I don't know if this section is intended to solve the problems with the existing applications of Sony, but it seemed the most appropriate for my question. If it does not fit here pls move. The main reason that I bought this tablet rather

  • in windows movie maker I get sound but no picture when I try to view loaded videos__

    I have sound but no picture in windows movie maker.  Have already tried to restore filters to the State of origin without success

  • Internal brand of hard drive to replace a default

    What brand of HDD internal to replace the former absence of a compaq presario CQ5320F 64-bit AY03011-ABL. Want to get even an or better without too much cost.