ListView grid change to list dynamically

Dear developers

I have a listview that is represented by a grid. But I want a menuaction to change the schedule to the list and vice versa. But it seems more difficult, so I thought. My griditems are different then my listitems. For those who must change too.

That's what I have so far but I'm stuck to be honest.

import bb.cascades 1.0

Container {
    property bool isGrid: true

    ListView {
        id: listView
        dataModel: channelListVM.otherDataModel
        horizontalAlignment: HorizontalAlignment.Fill
        layoutProperties: StackLayoutProperties {
            spaceQuota: 1.0
        }
        layout: isGrid ? gridLayout : stackLayout
        listItemComponents: [
            ListItemComponent {
                type: "gridItem"
                GridItem {
                    contextActions: ActionSet {
                        title: ListItemData.name
                        actions: [
                            ActionItem {
                                title: qsTr("Favorite")
                                imageSource: "asset:///img/bb_action_favorites.png"
                                onTriggered: {
                                    ListItemData.favorite()
                                }
                            }
                        ]
                    }
                }
            },
            ListItemComponent {
                type: "listItem"
                MyListItem {
                    contextActions: ActionSet {
                        title: ListItemData.name
                        actions: [
                            ActionItem {
                                title: qsTr("Favorite")
                                imageSource: "asset:///img/bb_action_favorites.png"
                                onTriggered: {
                                    ListItemData.favorite()
                                }
                            }
                        ]
                    }
                }
            }
        ]

        function itemType(data, indexPath) {
            if(isGrid) {
                return "gridItem";
            }

            return "listItem";
        }

        attachedObjects: [
            StackListLayout {
                id: stackLayout
            },
            GridListLayout {
                id: gridLayout
                columnCount: 3
                horizontalCellSpacing: 10.0
                verticalCellSpacing: 10.0
                cellAspectRatio: 1
            }
        ]
    }
}

And when I change the isGrid true or false, it amends the provision but it seems that the UI is not updated. How can I fix without working with 2 ListViews and hide/show them about the property?

Thanks in advance

Since you're using the itemType function you do not require a change in your database. However, given that you match the layout of your choice of item type, you will need to notify the ListView that its cache is no longer valid. If ListView will not selection of the type of return until you load a new element in its cache.

To do this, you just have your DataModel emit a signal after you change your property to isGrid. This is done via DataModel::itemsChanged. Since you want your entire list to rebuild, you want to give him the DataModelChangeType::Init.

Code wise, you need to add this call:

channelListVM.otherDataModel.itemsChanged(DataModelChangeType.Init)

Tags: BlackBerry Developers

Similar Questions

  • How to change the list of bookmarks

    Where can I find instructions to change the list of bookmarks?

    You can change the bookmarks in the bookmarks (library) Manager.

    Just to be sure you understand how this works:

    • By clicking on the star in the toolbar navigation go to bookmark the page in the "Unsorted Bookmarks" folder and the star lights in blue to show that
    • Bookmarks > 'Bookmark this Page' (Ctrl + D) going to bookmark the page in the folder of bookmarks Menu (you will need to confirm that)
    • 'Bookmark this Page' is accessible via the context menu in the area through the bookmarks menu or navigation in the menu or Firefox menu button drop-down bar (Alt + B)
    • If the URL in the active tab is set bookmark and the star is highlighted blue and then click the star highlighted or use "Bookmark This Page/Edit this bookmark" (Ctrl + D) to change the properties of the bookmark as the name and the location and move the bookmark to another folder or delete the bookmark
  • Spam: how to change the list of junk e-mail in iPad

    How to change the list of junk e-mail in iPad

    If your question is about - how to indicate whether or not an e-mail is sent to the junk e-mail folder-

    Your best bet would be to do it on the web portal of the email provider (e.g. for Yahoo it would mail.yahoo.com)

    There is usually a button or switch to designate mail "Junk" or "not junk".

    If your question is rather modify the list itself

    Mailbox - junk e-mail - Edit button is at the top right

  • ThinkPad Tablet 2 BIOS: I can't change the list of boot devices. Help, please!

    Hello community,

    I need to restore Windows on my ThinkPad Tablet 2 via USB. But I can't change the list of boot devices in BIOS. The F12 option is not available. It is said: "F12 key is used to call a pop-up the boot devices list. This option is available only when supervisor enters setup. »

    What can I do?

    Kind regards

    The problem is solved!

  • Authorization of 'change step list Configurations! -Still a bug?

    I did research on a problem we have regarding our developers are able to edit list step configurations.

    My problem is the same that this bug is entered in 2007.

    Authorization of 'change step list Configurations!

    http://forums.NI.com/NI/board/message?board.ID=330&message.ID=15230

    This bug was already registered or addressed?

    We use an external database to store the names of users and their group. If Privileges.Configure.GrantAll is not assigned by the developer group, described in the linked post buttons are grayed out.

    We prefer developers do not have the ability to edit the users, but they must be able to customize the appearance of the development environment.

    The bug was recorded (inside CAR #52133), but it has not yet been addressed.

  • How can I change the list of actions that appear when you right-click on a file?

    When you place your cursor over a file, then right click, you get a pop-up window with a list of actions that you can do in the file. Depending on the type of file, you get a different list of actions. How can I change this list. Or add or subtract from the it. Where Windows keeps related lists?

    In Windows Explorer, remove it all also missing button?
    Try to restore the files ZIP file association.

    For Windows Vista file association problems
    http://www.Winhelponline.com/articles/105/1/file-association-fixes-for-Windows-Vista.html

    Make a right click on the zip link, save target under... Right click on the REG file and choose merge. Note that you must be an administrator to apply these fixes.

  • Editable interactive report. To change the list column dropdown type filter.

    Hi all, I thought I had posted this, but I can't find my post, so apologies if it turns up to twice more...

    XE SUMMIT 4.2 11.2

    Ive created an editable interactive report... Everything works very well, and I have several Text, LOV and selection list columns...

    However when I now click on a column header to filter, sort etc drop-down list is the same format as the column itself. So if for example, I have a text box, then the drop-down list is also text boxes, if the column is a column LOV, the filter drop-down list is a list of fields LOV. (Im assuming this is correct behavior, because it simply inherits the column parent..)   So, I would change the lists to a list of standard display so that they are in order and can be used...

    I think so? I know I have to do, which is either to substitute the function that generates the dropdown filter... or probably more simply, write a bit of JS/JQuery that modify data for drop-down lists.  Im still to learn, some help would be appreciated...

    I think so. (and please correct me if I'm talkiing... garbage)   I need to find each of the appearance of the DIV with the ID that corresponds to the drop-down list box, and then loop through each entry and change the structure...

    Currently the source for drop-down fields resembles the following (for a text field...). :

    < div id = "apexir_rollover_content" >

    < a href = "javascript:void (false); ">

    < input type = "text" value = "24489" maxlength = size "2000" = "6" name = 'f06' > < / input >

    < /a >

    < a href = "javascript:void (false); ">

    < input type = "text" value = "N1021" maxlength = "2000" size = "6" name = 'f06' > < / input >

    < /a >

    < / div >

    How could I 1) browse each occurrence of div id = "apexir_rollover_content" on my page, so I found out about each other, how would I go through the list and change the line above an input to a standard list item text...? Or is there a simpler way to do it?

    Kind regards

    Richard

    Hello

    Problem was on your process to GET the VALUES of LOV.

    You did not bind the variable values of cursor.

    I created another process for your page that manages LOV BUDGET_CAT

    Kind regards

    Jari

  • Cannot change the list of participants

    I'm trying to change the list of participants, but I get a message saying that the "system is unable to process' .  Any ideas?

    Thanks for responding. My role was that of the host. In any case, I'm finally able to change the list of participants. I was told that Adobe Acrobat Connect Pro is 'down' for a day or two, and it's probably why I couldn't change the list. It seems to be okay now.

    Thank you

    Suzanne

  • Menu list dynamic PHP/Dreamweaver

    I have a mySQL DB with lists of address on it, I used the city column to fill a menu list dynamically w / PHP... No problem so far - but I cannot know how to that every city is ranked only once.

    In other words, I have 20 of the same city, on the DB column. I want that every city to appear once in the list menu.

    Any idea? I thought about it all day w / out a bit of luck!

    Thanks in advance,

    B

    On Wednesday, February 7, 2007 03:16:54 + 0000 (UTC), "za beezo.
    wrote:

    > In other words, I have 20 of the same city, on the DB column. I want to
    > each city to appear once in the list menu.

    Simply SELECT SEPARATE instead of SELECT
    --
    Steve
    Steve at flyingtigerwebdesign dot com

  • change the way dynamic link attribute value

    Is it possible to dynamically change the link of a workflow attribute value, attaching it to a configuration specific vCO (attribute) based on a drop-down menu in the presentation of the workflow?

    I'm looking for an easy way to maintain a minimal set of workflows and configurations for the provision of the ESX hosts based on the environment.  I have a unique set of workflows that manage commissioning, and multiple configurations of vCO defined by ESX hosting environment (i.e. values by default attributes/for DNS, AD, IP settings for laboratory, test, prod, site1, site2, etc..).  I would like to be able to select a hosting environment configuration given in a drop-down list when I start the workflow, which would then set some attributes of workflow to the value of their corresponding configuration attributes.

    Any ideas, or is there a better approach?

    You can check the object 'Server' script, there is a method to access the ConfigurationElementCategory and from there, you can get your ConfigurationElement.
    So, you can use the solution above, Martin and in access to script Action ConfigurationElement.

  • selection list dynamic default value

    Hello world

    I have a question about the dynamic selection lists.
    I have a report of a table that displays records. Each record has different versions of data. So when you click on a folder you get to another page where you get some information on this record and where you can select the version of this information (using a selection list).

    The selection list works very well and is set dynamically as follows:

    Select distinct b.SID display_value,
    return_value a.version_id
    cn_pl_version a.,
    cn_pl_std_peplanung b
    WHERE a.version_ID = b.version_id AND
    b.pe_id = "& P6_HELP_PRODET."
    a.version_id desc order


    My problem is that when I click on a folder that I always get the report filled with the oldest version of the current record, so I always choose the most recent version to the list manually. I always prefer to have the most recent version in the report.

    The report query is:

    Select
    ....
    ....

    (select sum (stunden) in cn_pl_std_peplanung t02
    where abt_id = '10'
    and t02.pe_id = t1.pe_id
    and t02.version_id = t1.version_id
    and t02.idee_id = t1.idee_id) stunden_ir;

    (select name from cn_pl_version u01
    where u01.version_id = t1.version_id) Version

    of cn_pl_std_peplanung t1, cn_pl_projektelemente z1, u1 cn_pl_version cn_pl_projektidee s1
    where t1.version_id = ' & P6_VERSION_WAHL. »
    and t1.pe_id = z1.pe_id
    and z1.pe_id ='& P6_HELP_PRODET. »

    Group of t1.pe_id, t1.version_id, t1.idee_id




    ' & P6_VERSION_WAHL.' is the element of the selection list
    ' & P6_HELP_PRODET.' is the ID of the current record

    I don't know if you understand my problem, my English is not the best...

    Thanks for any help!

    Patrick

    Hi Patrick,

    What value choose it show list, when you create a branch to the page? That's the good?
    If not, you must change your selection list, that the correct version is selected by default. You can set a 'default' value when you set the source of the element.

    Otherwise, you may configure a sample application to http://apex.oracle.com.

    Best regards
    Chrissy

  • I can't change my list of JIU, as only 3 addresses appear in the BCC field

    When I look at the BCC list in draft mode, there is an address that I have not entered, and I don't know the person whose address is, but I could not find a way to remove the address, because when I go into edit mode, only the last three addresses I entered are visible on three separate Bcc lines.

    In addition, in mode draft, I see that a number of addresses appears twice, because, at the time, I was entering them, I needed to save the work and click the sign-. But when I opened it the first time, because I saw that the first three addresses, I have assumed that I had lost the others, so started coming again. Now I need to delete duplicate addresses, but even once, find no way to do it, because once I'm in don't change only three mode addresses may appear.

    Please can you help me?
    Thank you
    Retro

    There is generally enough visible space 3-(Cc/BCC) fields as the automatic display.

    When there are multiple e-mail addresses can be established, a scroll bar should appear on the right side.

    However, by dragging the bar down reveals more.
    Place the cursor on the line and the cursor should change to a double arrow head.
    Left click and hold down the key to grab the line, and then drag.
    See the images below.

  • How to change fontsize list of the mailbox in Mail.app?

    I've closed and relaunched Mail.app, and when he returned, the list of mailboxes on the left side of the main window was oddly displayed in a significantly larger fontsize that I'm used to. I don't know how or why it happened, and I can't seem to find a way to remedy. Help? (I'm using Mail.app v9.3 - 3124).

    Check your preferences.   See if the tips here help:

    http://osxdaily.com/2014/09/16/how-to-change-the-mail-font-size-in-Mac-OS-x/

  • How can I change the list of "Attach a file" icons in the alphabetical list in the chonological order?

    When I want to attach a file to an e-mail message, it is usually the last file I worked on. Firefox to view items in a list in chronological order, with the most recent element at the top. Now, it displays icons (which I hate!) in alpha order, which is therefore not useful. I think that this change occurred after the last update, I have loaded for Firefox. I'd like suggestions on how to get back to my original format. Thank you!

    He finally found. But control is certainly in a dark place and the function 'Help' in Word has been totally useless.

  • Firefox doesn't let me change my list of homepage. I tried all the suggestions to solve them.

    As you can see below, I have a ton of bookmarks of the opening. I regularly rearrange, add, and remove them as my interest increases or decreases. Last week, maybe two, Firefox stopped allowing me to modify the list. It took awhile to notice, but on the last few days, I've been tearing my hair out trying to fix it. He began also do not let me change that represents I connected to Google +, I don't know if it of related or not.

    I tried to reset the default list. I tried to leave it blank. I tried to delete the preference files. I tried to reset Firefox completely. Whenever I load Firefox it resets the list of homepage that he had before. I'm quite frustrated. What I have to remove Firefox and reinstall from scratch, or is there something else I can try?

    Thank you.

    If Firefox does not close properly, your changes of settings in your session could not fully recorded.

    Could you check in the Advanced SystemCare (outside Firefox) software and disable its features related to the protection-browser to see if that makes a difference?

Maybe you are looking for

  • I t photo post 2001

    Hi, I have "microsoft picture it Publishing 2001" it ran on the windows 98 / ME and then re loaded on XP but your site says it is no longer compatible with vista that I am running, If this is the case can you recommend me something similar, because i

  • External hard drive formatted with Linux OS

    The external hard drive can be seen in devices and tested as working properly, but not seen in a different folder on my computer, can not be opened. In addition, the system says that all drivers are installed.

  • How to restore my first backup of a DVD-R disc and subsequently two other backups? I don't have a computer image.

    I opened the options in system recovery Menu, but I have not anywhere; System 32 (?) was one of the optiions.  Is it possible to see/read the date/info on these discs?  Stickers for info I put on the discs came out.Also, how do I restore / turn on Su

  • BlackBerry smartphones 'frozen' download from app world dictionary

    I'm trying to download a free trial of the Oxford American Dictionary. I had some problems to do it and now all I have in 'my world' is the program saying start download without movement of the status bar. It has been like that for about 45 minutes n

  • Accsss device based on NDG using ACS 5.2

    Hello I have 2 DC & Office network types. I have 3 types of LWOP users, office & DC. Office peripheral netowrk are in NDG of office, peripheral network DC are in NDG DC. Such configuration DC, office network users can access only desktop devices & DC