Update a listView when a page is skipped

Hi all

I'm new in the cascades, in the developing world. I'm trying to do a two pages about the first page exposure items to a listview and has buttom "new item" action at the bottom. it triggers now pushes the second page that contains fields for a new record. He has a backup action button. When trigged inserts the element in the database and revealing the first page is displayed. My problem is that the new record is not displayed on the page. at least I got close and reopen the application. I use a sql database to populate the list. and I do everything in the cascades (no C++ backend)

Thanks in advance for your help.

Welcome on the support forums.

you have several options.

-Insert the item in sql, then reload the entire listview. You can do it by listening to the signal onTopChanged of the navigation pane.

-inclusion of the item in the list or the model data (as well as in sql). It's a better solution in most cases, at least if the sorting is not done by sql or similar.

Tags: BlackBerry Developers

Similar Questions

  • update a ListView when dataModel changes

    Hi gang,.

    I have a defined GroupDataModel as a Q_PROPERTY a class custom C++.

    I join this GroupDataModel a ListView in QML.

    Make changes to the items in the GroupDataModel by pulling on the elements in the model in a ListOfObjects.

    I can see that the changes are effective for exit qDebug(), but the ListView refresh.

    Q_PROPERTY, I have a NOTIFY signal defined (on onItemListChanged), and in the function where I edit items, I emit this signal (emt onItemListChanged(), but the ListView does nothing.)

    How can I get the updated list?

    Here is the function update the items.

    void WorkManager::updateKey(QString newKey, int whichObject) {
    
        if (!newKey.isNull()) {
            QList  myObjects = m_model->toListOfObjects();
                    Task * myTask = (Task *) myObjects[whichObject];
                    qDebug() << "object is : " << myObjects[whichObject];
                    qDebug() << "object key is: " << myTask->key();
                    myTask->setNotifyKey(newKey);
                    emit onItemListChanged();
                    qDebug() << "modified object key is : " << myTask->notifyKey();
        }
    
    }
    

    do I need to connect a signal to a slot somewhere?  I thought that this will be done automatically.

    THX,

    J

    Ah, I see. I really have to update the model to get this fire its signals.

    Add this:

                 QVariantList indexPath = m_model->findExact(myTask);
                    qDebug() << "WorkManager::updateItem(), indexPath is : " << indexPath;
                    m_model->updateItem(indexPath, myTask);
    

    makes work.

    Here is the full function:

    void WorkManager::updateKey(QString newKey, int whichObject) {
    
        if (!newKey.isNull()) {
            QList  myObjects = m_model->toListOfObjects();
                    Task * myTask = (Task *) myObjects[whichObject];
                    qDebug() << "object is : " << myObjects[whichObject];
                    qDebug() << "object key is: " << myTask->key();
                    myTask->setNotifyKey(newKey);                                QVariantList indexPath = m_model->findExact(myTask);                                qDebug() << "indexPath is : " << indexPath;                                m_model->updateItem(indexPath, myTask);
                    qDebug() << "modified object key is : " << myTask->notifyKey();
        }
    
    }
    
  • Small update on screen when changing pages

    Hi all, we note a few pixels change on the display of the pages when I change pages in the menu (it is easier to see on the big screen). The entire page moves from left to right or from right to left. Of course, I use the same master page to all pages. You can see the construction site in this address: home . Anyone know why and how fix it? Thank you

    It's the vertical scroll bar that doesn't appear on pages with more content than a single screen.

    In page properties, you can change the visibility of the scroll bar for "always on".

    (Sorry, I don't know the term exact English.) Maybe the screenshot for help.)

    Fenja

  • The updated Photoshop "freezes" when I click on open or create a new page.

    The updated Photoshop "freezes" when I click on open or create a new page. I have to wait a minute or two and then work. Everything works normally. When I press file / open - new 'freeze '. I did the last update.

    Hi damijant,

    Suggest make you in Photoshop preferences > General > uncheck "Show workspace start when no documents are open" > restart Photoshop and check again.

    Let us know if that helps.

    Kind regards

    ~ Mohit

  • I always get requests to update on my office home page. After the most recent, most of my quick start icons are badges of adobe. Except a few functions are not open. When I right click on Firefox (for example) it says 'READ' instead of 'OPEN' and t

    I always get requests to update on my office home page. After the most recent, most of my quick start icons are badges of adobe. Except a few functions are not open. When I right click on Firefox (for example) it says 'READ' rather than 'OPEN' and then displays the Adobe error box. The only other answer I received (from Ask.com) is that the update was a virus. I'm not computor savy and my pc is quite old. I just want to come an hour before this recent action, but I can't open Norton power eraser or even the ability of the computer to return to an earlier point in time to cancel the action. Each of these attempts of task appears Adobe error box. I am currently showing Adobe Reader X 10,0

    Hi deanrlh,

    I apologize for the inconvenience caused. Please follow the steps in the below article mentioned: Application, file icons change in Acrobat/Reader icon

    Thank you

    Abhishek

  • Why if display "disintegrate" when I page or scroll?

    When a page is displayed first, seems ok. Scroll down, generally ok. When I scroll to the top, text appears incorrectly, as if the pixels are scrambled. It happened on this site, when I register and I don't not even scroll. The browser redisplays just a sentence, and he had a falling out.

    Hello, it could be a problem with hardware acceleration - try updating your graphic driveror where this does not solve the problem, or there is no new version available at the time, disable hardware acceleration in firefox > options > advanced > General.

  • Why sites keep telling me to update my browser when it is already updated? Example - what happens when I try to access my e-mail and other sites.

    Why sites keep telling me to update my browser when it is already updated? I already updated my browser and even tried to reinstall. Example - what happens when I try to access my e-mail and other trusted sites.

    Hello

    Some Firefox problems can be solved by performing a clean reinstall. This means that you remove Firefox program files, and then reinstall Firefox. Please follow these steps:

    Note: You can print these steps or consult them in another browser.

    1. Download the latest version of Firefox from http://www.mozilla.org office and save the installer to your computer.
    2. Once the download is complete, close all Firefox Windows (click on quit in the file menu or Firefox).
    3. Remove the Firefox installation folder, which is located in one of these locations, by default:
      • Windows:

        • C:\Program Files\Mozilla Firefox
        • C:\Program Files (x 86) \Mozilla Firefox
      • Mac: Delete Firefox in the Applications folder.
      • Linux: If you have installed Firefox with the distribution-based package manager, you must use the same way to uninstall: see Install Firefox on Linux. If you have downloaded and installed the binary package from the Firefox download page, simply remove the folder firefox in your home directory.
    4. Now, go ahead and reinstall Firefox:
      1. Double-click on the downloaded Setup file and go through the steps in the installation wizard.
      2. Once the wizard is completed, click to open Firefox directly after clicking the Finish button.

    Please report back to see if this helped you!

    Thank you.

  • Tools, Windows Update does not acquire web page

    When I try to update my IE 8 web page does not open.

    When I try to update my IE 8 web page does not open.

    If you go, IE8 > tools > Windows Update... It will NOT give you a web page. It gives the Windows Update window, the same as you can get via the control panel.

    What operating system do you use?  Mine is Vista.

    t-4-2

  • Update of ListView dummy image using images from URL http

    Hi guys...

    Please help me with this.

    I have created a ListView in QML file and filled with data received from a webservice. Since this web service provides all the images, I have to place a dummy image at this location. Then I used another method to retrieve images of the url. Now, I got the image in my CPC file. But I could not update my listview. I tried several methods. But failed.

    Here is my code snippet.

     ListView {
                    id: listView
                    objectName: "listView"
    
                    dataModel: ArrayDataModel {
                        id: myListModel
    
                    }
    
                    // Override default GroupDataModel::itemType() behaviour, which is to return item type "header"
                    listItemComponents: ListItemComponent {
                        id: listcomponent
                        // StandardListItem is a convivience component for lists with default cascades look and feel
                        StandardListItem {
                            title: ListItemData.postText
                            description: ListItemData.postDate
                            status: ListItemData.filePath
                            imageSource: "asset:///images/4.png"
                        }
    
                    }
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1.0
                    }
                    horizontalAlignment: HorizontalAlignment.Fill
                    verticalAlignment: VerticalAlignment.Fill
    
                }
    

    In the PRC, I get my image like this.

    void PostHttp::imageFetcher(){
    const QUrl url("http:///828/828_20135312012288.png");
    if (flag1 == true) {
        get(url);
    }
    }
    void PostHttp::onImageReply(){
        QNetworkReply* reply = qobject_cast(sender());
        QString response;
        QImage img;
        QString filePathWithName = "data/img/";
        QString imageName;
    
        if (reply) {
                if (reply->error() == QNetworkReply::NoError) {
                    flag1 = false;
                    const int available = reply->bytesAvailable();
                    if (available > 0) {
                    const QByteArray buffer(reply->readAll());
                    response = QString::fromUtf8(buffer);
                    img.loadFromData(buffer);
                    img = img.scaled(40, 40, Qt::KeepAspectRatioByExpanding);
                    const QImage swappedImage = img.rgbSwapped();
                    const bb::ImageData imageData = bb::ImageData::fromPixels(
                            swappedImage.bits(), bb::PixelFormat::RGBX,
                            swappedImage.width(), swappedImage.height(),
                            swappedImage.bytesPerLine());
                    bb::utility::ImageConverter::encode(QUrl(QDir::currentPath() + "/shared/camera/img.png"), imageData, 75);
                    qDebug()<<"current path is "<
    

    Thanks in advance

    You can pass a QByteArray of image data coded directly to an imageView in the image property, set of QVariant::fromValue (). However, in your case you can place the uri to which you saved the image and not the bytes. Advantage: cascades puts these images in cache. If you use deterministic file names, you can avoid any networking calls or loading of images when only the populated list of point sier after be recycled.

    img.loadFromData(buffer);
    img = img.scaled(40, 40, Qt::KeepAspectRatioByExpanding);
    img.save(QDir::currentPath() + "/shared/camera/img.png"), 0, 75);
    

    QImage can do all this for you, without permutation of bytes.

    All you have to do is then updated the datamodel.

  • What signal is emitted in the ListView, when one of its cells appears in or from the screen turns off?

    What signal is emitted in the ListView, when one of its cells appears in or from the screen turns off?

    I created listView with custom listItemComponents

    Is there any signal when listItemComponent go to the screen?

    Currently, it is not possible to detect if the cells turns off the screen. Even if you join LayoutUpdateHandler them they will just stop send updates when you go off the screen. I managed to hack a solution using a timer, but I guess that a cleaner approach would more use a ScrollView with CustomControls instead:

    1. get the dimensions of the ScrollView joining ScrollView LayoutUpdateHandler.

    2. attach the LayoutUpdateHandlers to the CustomControls.

    UPD: It is also viewableArea & viewableAreaChanged event scrollView property.

    3. If the controls that were inside the visible area of the ScrollView went outside, raises the event.

    Of course re-use of cell works that way.

    It's so easy to grab the cell on the screen:

    If you use ListItemProvider, updateItem() function is called when the element appears on the screen:

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__listitemprovider.html

    It will also be called if the data item are updated in the model.

    When the item is created for the first time, createItem() is called.

  • update report dynamically? (without page refresh)

    I have a page with several regions, and that a region is visible at a time. Each region contains a report as well as a drop down menu to change the data displayed in the report. Currently, whenever a value drop-down list is changed he submits the page, causing the "main area" to become visible because it is set by default to display first.

    Is there a basic tutorial I can follow on how to dynamically upgrade report output without a page refresh?

    Thank you
    Steve

    Steve wrote:
    I have a page with several regions, and that a region is visible at a time. Each region contains a report as well as a drop down menu to change the data displayed in the report. Currently, whenever a value drop-down list is changed he submits the page, causing the "main area" to become visible because it is set by default to display first.

    Is there a basic tutorial I can follow on how to dynamically upgrade report output without a page refresh?

    The best way to do this is by using dynamic measurements. Create a dynamic refresh action for each region that runs when the associated select list is changed:
    H4. When

    Event: change
    Selection type: item (s)
    Article (s):

  • Hallo why? When I update ios. When the image has finished error itunes and usb

    Hallo why? When I update ios. When the image has finished error itunes and usb

    Connect the iPhone to the computer that you are synchronizing usually with

    and follow the prompts to iTunes on this computer. If you

    do not generally in sync with a computer, you should always use

    iTunes on a computer to complete the update.

  • Why what I receive update alerts, but, when I check, I said I use the latest version of FF?

    Why what I receive update alerts, but, when I check, I said I use the latest version of FF?

    Try to repair disk permissions:

  • When several pages are open, I want to see a thumbnail image of the page hot description

    When several pages are open, I want to see a thumbnail image of the page to warm an edit summary description

    You can get an overview of all the tabs opened using the functionality of the tab groups.

    You can see a miniature of a tab preview when you place your cursor on it using the extension of the scope of the tab.

  • Hello. I'm just a beginner and I downloaded the itunes 12.3.3 update and now when I right click on a work of art albums all disappear from the track of this album. I also have problems with my get info tab. All of my info from the album crashes.

    Hello. I'm just a beginner and I downloaded the itunes 12.3.3 update and now when I right click on a work of art albums all disappear from the track of this album. I also have problems with my get info tab. All of my info from the album crashes.

    This can help (from turingtest2):

    Fix iTunes for Windows security permissions

Maybe you are looking for

  • HP Envy 5660: My computer won't PDFs on the Internet

    Whenever I try to print a PDF on the Web, I get circles of rotation with "Connecting" message, but never, it connects or prints. If I download the file, the same thing happens. Like others, I don't have a problem with printing or Excel documents the

  • seriously damaged 6s - Apple iPhone screen will replace just the screen?

    So, I got a new 64 GB iPhone 6 in September last year because Verizon forced me to upgrade my old 5 c.  I had initially purchased AppleCare + under the pretext that the policy CA + had not changed and that if damage were to occur on the screen that t

  • HP S2031 monitor: S2031

    Suddenly, my monitor has stop working and falls asleep without coming on. I get a message saying "Check video cable".  I tried to disconnect and reconnect the DVI cable and the power cord. I had no previous problem.

  • A6210 not detected and no led light

    Hello! I have a problem with my adapter wifi and id as a solution, basically when I got my netgear upgrade wasn't my thing more it was not detected, I tried on my brothers computer and also, it did not work. I don't know if it's the software or the h

  • Finder always crashing

    Hi guys,. Whenever I open the Finder by clicking on the icon in my Dock, Finder blocks 100% of the time. It seems he's trying to open my previously opened tabs (Documents and a folder in iCloud drive). However, I can open Finder by using other method