Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4125940
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:56:06+00:00 2026-05-20T23:56:06+00:00

I’ve decided to give Dojo a shot instead of using JQuery for once, and

  • 0

I’ve decided to give Dojo a shot instead of using JQuery for once, and am having trouble manipulating a data store. I’ve got a DataChart bound to the contents of an ItemFileWriteStore i’ve populated by hand from a web socket JSON message:

fakeData = {
        "identifier": "name",   
        "label": "Some data i'd like to add to later",
        "items": [
            {
                "name": "appendToMe",
                "values": [0.0, 1.0, 2.0, 3.0, 2.0, 1.0, 0.0]
            }
        ]
    };

store = new dojo.data.ItemFileWriteStore({
        data: fakeData
    });

var chart = new dojox.charting.DataChart("chartDiv", {});
chart.setStore(store, {"name":"*"}, "values");  

At this point, the graph is displaying the “appendToMe” series i’ve created. Next, I receive another message, containing some new numeric value for the “appendToMe” values list.
How do I add it to the store, and will this be sufficient to trigger the graph to update?

I’ve looked at the [](write API) ‘store.setValue’, but it looks like I can only use this to replace the whole values chunk as one unit. In addition, I don’t have a ‘item’ handle to use with the call, which appears to only be available if you use the newItem API instead of constructing the store with JSON.

Cheers!

Scott

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:56:07+00:00Added an answer on May 20, 2026 at 11:56 pm

    First you need to fetch the appendToMe item.

    store.fetchItemByIdentity({identity : 'appendToMe', 
                                          onItem : function (item) {
       var itemValues = store.getValues(item, 'values');
       itemValues.push(someNewValue);
       store.setValues(item, 'values', itemValues);
    }});
    

    Then in the onItem, get your values, modify them, and then set them again using store.setValue()

    As noted, getValues needs to be used to return the array of values instead of the usual getValue, which never returns an array. And similar with setValues.

    http://dojotoolkit.org/api/1.6/dojo/data/api/Read

    This getValues() method works just
    like the getValue() method, but
    getValues() always returns an array
    rather than a single attribute value.
    The array may be empty, may contain a
    single attribute value, or may contain
    many attribute values. If the item
    does not have a value for the given
    attribute, then getValues() will
    return an empty array: []. (So, if
    store.hasAttribute(item, attribute)
    has a return of false, then
    store.getValues(item, attribute) will
    return [].)

    setValues()
    http://dojotoolkit.org/api/1.6/dojo/data/api/Write

    Adds each value in the values array
    as a value of the given attribute on
    the given item. Replaces any previous
    value or values. Calling
    store.setValues(x, y, []) (with
    values as an empty array) has the same effect as calling
    store.unsetAttribute(x, y).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.