How to manage updates of data in ArrayDataModel

Hello

I load some data from a JSON file in a QVariantList which is then added to an ArrayDataModel that allows to display the data in a ListView. It all works very well. Now, I want to update certain values of a ListViewItem and want to propagate these changes to the ArrayDataModel-> QVariantList-> JSON file. How I would handle this? Should I update the DataModel, ListView or even the QVariantList? Loading and display of data in a ListView are very well documented, but I can't find information on reverse litle?

Any help will be greatly appreciated!

You can access the dataModel of ListView items so it is possible to directly manipulate.

Outside the ListView join dataModel signals such as

void   itemAdded (QVariantList indexPath)
void    itemUpdated (QVariantList indexPath)
void    itemRemoved (QVariantList indexPath)
void    itemsChanged (bb::cascades::DataModelChangeType::Type eChangeType=bb::cascades::DataModelChangeType::Init, QSharedPointer< bb::cascades::DataModel::IndexMapper > indexMapper=QSharedPointer< bb::cascades::DataModel::IndexMapper >(0))

You'll probably have to subscribe to each of them as you know what changes you make to the dataModel. For example, if you only update the elements subscribe to itemUpdated etc..

In Manager signals, extract the dataModel changes and save them to the disc.

PS Don't forget to subscribe to the changes that the dataModel is initially populated.

Tags: BlackBerry Developers

Similar Questions

  • How can I update the data in mysql using the button defined in the table?

    Hello

    right now I am doing my project for the online election system using dreamweaver cc14. I create a table using php code to bind the data to mysql, and in this painting, I create also a button "vote" for voters to vote. My question is, how can I update my polling data in the mysql database when voters push button "vote" based on the id of the candidates? Here is my code I try:

    <form method="post" id="form1">
          <?php
    $servername = "localhost";
    $username = "root";
    $password = "pass";
    $dbname = "ses";
    
    
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
         die("Connection failed: " . $conn->connect_error);
    } 
    
    
    $sql = "SELECT No, Calon, ID, Jurusan, Image FROM candidates";
    $result = $conn->query($sql);
    
    
    if ($result->num_rows > 0) {
         echo "<table >
      <tr>
      <th>NO</th>
      <th>Candidate</th>
      <th>INFO</th>
      <th>Vote</th>
      </tr>";
         // output data of each row
         while($row = $result->fetch_assoc()) {
             echo "<tr>
      <td>" . $row["No"]. "</td>
      <td><img src=" . $row['Image'] . "></td>
      <td><br/>-" . $row["Calon"]. " <br/>-" . $row["ID"]. " <br/>-" . $row["Jurusan"]. "<br/></td>
      <td><input type="."submit"." name=".$row["Calon"]." id=".$row["No"]. " value="."Vote"."></td>
    
      </tr>";
      if(isset($_POST["".$row['No'].""])){
    
      $vote_sachin = "UPDATE candidates SET Undi=Undi+1 WHERE No=".$row["No"]. "";
    
      $run_sachin = mysqli_query($conn, $vote_sachin);
    
    
    }
        }
      echo "</table>";
    } else {
         echo "0 results";
    }
    
    
    
    
    
    
    $conn->close();
    ?>
    
    
    
    
        </form>
    

    I hope someone can help me in this area, because I'm still new in this programming language.

    Thank you.

    Youre probably going to insert a 'radio button' next to the names of candidates and recover the database ID of that (I guess that the ID is the primary key in your database that uniquely identifies each record.

    His great confusion because you seem to update the database to aid WHERE no = "." $row ["no"]. so I don't know that ID is the primary key?

    IF "No" IS your master database key, you need to change the code below:

    TO:

    Here's the complete code based on the ID of your primary database key.

    <>

    $servername = "localhost";

    $username = 'root ';

    $password = "pass";

    $dbname = 'his ';

    Create the connection

    $conn = new mysqli ($dbname, $servername, $username, $password);

    Check the connection

    If {($conn-> connect_error)

    Die ("connection failed:".) $conn-> connect_error);

    }

    $sql = "SELECT No, Calon, ID, Jurusan, Image OF candidates";

    $result = $conn-> Query;

    If you click on the button "vote" form run the code to update the database below

    {if (isset($_POST['vote']))}

    Get the value of the ID of the radio button form field and store it in a table.

    $update_vote = $_POST ['candidate_id'];

    loop in the table and update the database

    foreach ($update_vote as $value) {}

    $vote_sachin = ' candidates UPDATE SET Undi = Undi + 1 WHERE ID = ".". " $value. » « ;"

    $run_sachin = mysqli_query ($conn, $vote_sachin);

    }

    }

    ?>

    <>

    If ($result-> num_rows > 0) {}

    ECHO '.

    ";

    each line output

    While ($row = {$result-> fetch_assoc())}

    ECHO '.

    ";

    }

    ECHO '.

    ";

    ECHO '.

    NO. Candidate INFO To the vote
    " . $row ["no"]. "
    -" . $row ["Calon"]. "
    -" . $row ['ID']. "
    -" . $row ["Jurusan"]. "
    ";

    } else {}

    echo "0 results."

    }

    $conn-> close();

    ?>

  • How can I update the date cancellation in usr table IOM

    Hello

    I wrote a process task adapter which will return a date. I want to map this date with Deprovisioning return date to the table of the USR.

    While you map this date of return to definition by the user, I don't see the option 'Date of Deprovisioning' playoff from the drop-down list.

    So how can I map this date back to the date of cancellation?

    Basically I want to update USR_DEPROVISIONING_DATE with the date of return of my adapter to process task?

    Pls suggest.

    Thank you

    It may be useful

    Unable to update the dates of start/end with updateUser API

  • How to manage the attribute date, passing the parameter from one page to another

    Hi friends,

    I want to spend attribute data from one page to another page-

    I'm passing as below, in the log window jdev I get error below.
    String StatusUpdateDate = row.getAttribute ("StatusUpdateDate");
    params.put ("StatusUpdateDate", StatusUpdateDate)
    Error (121.50): incompatible types. found: java.lang.Object, required: java.lang.String


    Suppose that I'm passing as below, while moving from one page to the other, I am getting error in the application below
    String StatusUpdateDate = row.getAttribute("StatusUpdateDate").toString)
    Date of update of State - Houston-25009: failed to create an object of type: oracle.jbo.domain.Date with value: 26-MAR-2009

    Please you can suggest me how to handle this error.


    Thank you and best regards,
    Vandenplas

    Hello

    Vandenplas

    you're right, this method is to launch error, which is why I got, bcz timstamp is also not implmenting Serializable interface, is there he throwing error at run time

    u just go this way

    another page of request-Destination page Controller-Process-

    Add a new line below the following line

    DATE StatusUpdateDate = (DATE) pageContext.getTransactionTransientValue ("StatusUpdateDate");

    String stringStatusUpdateDate = StatusUpdateDate.toString ();

    and also in your AM CODE

    change your method like this

    public void testselection (String Name, String Email, String product, the string, String StatusUpdateDate)

    hope this will solve the problem

    thanx

    Pratap

  • How can I update the date seconds.

    Hello

    I did say Starttime in an application that has the value sysdate on click of a button. And even is updated on the table too.

    This is the type of date.

    Is there a way to make the seconds as 00 when inserting

    for example: sysdate is 22 June 13 02:18:24:03...

    When I update/insert I want it like 22 June 13 02:18

    Thank you

    Archana

    Hello

    TRUNC (SYSDATE, 'MI') returns SYSDATE with seconds changed to 00, and the rest of the day unchanged.

  • Try to update tcDataSet date null date field.

    I'm trying to set a field to a null user-defined. I am able to update the field with a valid date but cannot be set to null. Here is an example of the code that I use.

    ...
    HashMap.put ("usr_udf_new_last_name_effdt", "1970-01-01 00:00:00.0");
    ...
    tcuseroperationsintf.updateUser (new tcMetaDataSet (usrDataSet, getDataBase()), hashmap).

    The problem is when I try to update the date that follows.

    ...
    HashMap.put ("usr_udf_new_last_name_effdt", null);
    ...
    tcuseroperationsintf.updateUser (new tcMetaDataSet (usrDataSet, getDataBase()), hashmap).

    When I try this I get an exception. How do you update a date field to a null with tcDataSet?

    Hello

    You cannot update the daye with null field. You must put a fictitious date.

    Concerning
    Nitesh

  • I managed to see the profile of the artist in Apple's music. How can I update the profile picture?

    I managed to see the profile of the artist in Apple's music. How can I update the profile picture?

    This is a user forum. No Apple itself is allowed to answer your questions here.

    You are probably better contact Apple Support directly to get an answer to your question.

  • How can I update the expiration date on my credit card account?

    How can I update the expiration date on my credit card account?

    How can I update the expiration date on my credit card account?

    Go to your Bank and get a new card.

  • When I try to use the Windows Update link for my XP computer I get a message indicating that the location where the Windows Update stores data has changed and it needs to be repaired. How can I solve this problem?

    When I try to use the Windows Update link for my XP computer and after using Windows Mr. Fix - It, I get a message indicating that the location where the Windows Update stores data has changed and must be repaired. How can I solve this problem?

    I'm not that computer literate and do not understand what needs to be fixed.

    This problem just started a few weeks when I noticed that I had any recent download automatic update that I regularly get. So I tried to do it manually through access via my control panel.

    I use ESET Antivirus Node32 software.

    Hello

    1. What is the error message or an exact error code?

    2 have you made changes on the computer before this problem?

    3. you try to check the updates?

    I would suggest trying the following methods and check if it helps.

    Method 1:

    Reset Windows Update components and then try to download the updates.

    How to reset the Windows Update components?

    http://support.Microsoft.com/kb/971058

    Warning: Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base: http://support.microsoft.com/kb/322756

     

    Method 2:

    File system scan tool checker and then try to press Ctrl + Alt + Delete and check.

    Description of Windows XP and Windows Server 2003 System File Checker (Sfc.exe):

    http://support.Microsoft.com/kb/310747

    Please respond with more information so that we could help you more.

  • How will I know that my bios is up to date and if not how can I update

    How will I know that my bios is up to date and if not how can I update

    For any questions about the Bios, contact the manufacturer of your computer if Vista was preinstalled, or the manufacturer of the motherboard if you have built your own system...

    BIOS issues outside of these Forums.

    See you soon. Mick Murphy - Microsoft partner

  • My graphics card has a driver that is 9 years old, I know there are newer drivers for it. How did microsoft update tells me it's up-to-date.

    My graphics card has a driver that is 9 years old, I know there are newer drivers for it. How did microsoft update tells me it's up-to-date.

    Your option is to buy a Windows 10 compatible graphics card, only very rarely a graphic map of the era XP would be appropriate/compatible with Windows 10.

    See you soon.

  • How to manage data in css bar chart plugin

    Apex 4.2 running against database 11 g.  I have a CSS bar graph plug in the regions. Now, if there is no data found in a given region the region of bar chart is empty.  I want to display a message in the box indicating no data found rather than having just a blank area but I don't see how.  When I look at the plug of standard attributes the 'No data found Message attribute a' is disabled so I'm not able to check it out.

    The data source for the bar chart is a collection that is populated by calling a stored procedure that returns a sql query string.

    Any suggestions for how to manage this?

    nunyadba wrote:

    Apex 4.2 running against database 11 g.  I have a CSS bar graph plug in the regions. Now, if there is no data found in a given region the region of bar chart is empty.  I want to display a message in the box indicating no data found rather than having just a blank area but I don't see how.  When I look at the plug of standard attributes the 'No data found Message attribute a' is disabled so I'm not able to check it out.

    The data source for the bar chart is a collection that is populated by calling a stored procedure that returns a sql query string.

    Any suggestions for how to manage this?

    One way is to create shadow graphic HTML containing the "no data found" messages for each of the regions. Use Exists (SQL query returns at least one row) conditions to display the chart area when relevant data exist in the collection, and NOT Exists (SQL query returns no line) conditions to show the "no data found" region when it isn't.

    Another would be a dynamic action that verifies the existence of the graphical mark in each region and injects "no data found" messages where it does not exist.

    Change the plug-in (if allowed by the license) would be the last option.

  • How do you update a host unique vm with Update Manager

    I have a single vmware esxi 4.1 host on a remote site and vcenter is a virtual machine, as well as 2 other virtual machines.  It is the target of SRM as well.

    In any case, I tried to address updates in the Update Manager and it expires just waiting to the power off vm.  There is no other host VM in this cluster is not as if something can vmotion off.  So I'm wondering because the Update Manager vcenter server running running on THIS host, if it were to close then maybe Update Manager could not perform?

    How can I update this host, currently on 4.1.0 260247.

    I have an another ESXi 4.0.0 171294 clocked at that site and it can also access the shared storage that can the 4.1 server.  I can't handle this in vCenter and vMotion things to him because I don't have a license to do.  But could I import vcenter to do this and it turns on and then try to restore the other host?

    Thanks for the help.

    patches are cumulative.

    you don't need a vma, its good for multiple hosts.

    just ssh into your box directly if you have only one box

  • How to manage old data?

    It is a very generic question. We use the oracle database. We hold the records of the company in the database. The company records should be available at any time, but over the years that the database continues to grow. Now, how to manage old data. All data are important, but if this is true for several years yet we more and more disk space to manage. Are there effective methodologies to manage old data? For us the old means data that are 10 years old.

    Murray9654 wrote:

    My main concern is the number of disks required. The database continues to grow for years. So how long can we continue to increase the record. It is not about the cost. I'm not sure of what will be the amount of data after 30 years.

    If the cost is not a concern, number of disks shouldn't be a concern.  In the end, you need what it takes to take what you have.  There's no silver bullet to get 50 gallons of sewage in a 10 gallon tank.  How big is your database now?  What is your current disk arragnement - local disks, SAN, NAS...

    Your statement "should be available at any time" seems to eliminate the storage of archives, out-of-database as a band.

  • How to update the data, including ' @' character.

    Hi all

    I am running this script to update as .sql command line (windows). but I'm getting... .error as... Unknown command-

    SP2-0734: unknown command beginning by "customer:...» "- rest of line is ignored.
    SP2-0734: unknown command beginning with "Offer numb..." "- rest of line is ignored.
    SP2-0734: order unknown beginning "\@aresp_li...". "- rest of line is ignored.
    SP2-0734: unknown command beginning by "country:------...» "- rest of line is ignored.
    SP2-0044: for a list of known commands type HELP
    and to let EXIT.

    the script is the following... update.sql

    UPDATE BY EMAIL
    SET
    Objet_message = "waiting for your approval of Document: @appr_document_no - @prop_num - @cust_name ',"
    EMAIL_BODY = "click on the link below to view and approve the document.

    Client: @cust_name
    Offer number: @prop_num
    @aresp_link

    Country: @country_id ' WHERE EMAIL_ID = '1234';



    Please guide me how to upgrade this including data ' @' character.

    Thanks in advance.

    Hello

    By default, SQL * more does not completely empty lines in the middle of an SQL statement.
    In SQL * Plus version 10 (or higher), you can tell SQL * more to allow completely blank lines in a session by saying

    SET   SQLBLANKLINES   ON
    

Maybe you are looking for

  • OfficeJet 6700: print in black only

    I am wanting to print in black only. I removed the color cartridges printer doesn't like that we So, how can I disable the color cartridges? John

  • FS728TP Ports SFP switch

    Will an addoncomputer.com JD118B-A0 (MMF SFP 1000Base-SX in a FS728TP switch function?

  • game disc I'm color lines thick green red blue what could cause this?

    When I load a game disc or try to play deer animated screensaver I get thick lines of color!  I can play games online very well! How can I fix this or find out what it is?

  • Captivate 9 compatibility JAWS

    I have accessibility features works pretty well, after a lot of trial and error.  There are always two elements that make it impossible to say that Captivate can be compatible with screen readers.1. the reading of the text is always interrupted by th

  • 1177 error when try to import raw images in Lightroom 3

    Hi, I use Adobe Photoshop Lightroom 3 (version 3.6) on a Mac. I recently upgraded from Canon mark I to Mark III, and when I try to import my files I get the error code 1177 (the files came from a camera which is not recognized by the assumption of ra