PDA

View Full Version : Error: record.join is not a function



napiform
28 Jun 2011, 6:18 AM
Hello all -

I am trying to implement a simple JSON store that I can update on the fly. Below is my prototype. It does not work, instead I get the error "record.join is not a function". Does anyone have a suggestion? Thanks very much in advance.


var fruits = new Ext.data.JsonStore({
root: 'fruits',
autoLoad: true,
fields: ['name', 'classification']
});

var apple = {fruits: {'name': 'apple', 'classification': 'fruit'}};

fruits.add(apple);

skirtle
28 Jun 2011, 5:27 PM
Read the documentation. The add() method takes an array of records, not a block of data. Use loadData() instead.

napiform
11 Jul 2011, 5:40 AM
Thanks, @skirtle.

Follow-up question:

If I loadData(a) and then loadData(b), the store now contains just b. Is there a way to sequentially load a and then b and have the store contain both records?

Thanks very much for your time.

Uberdude
11 Jul 2011, 5:46 AM
Read the documentation for loadData, it has a 2nd parameter you will find useful.

napiform
11 Jul 2011, 5:55 AM
Thanks, @Uberdude. That's a big help.

Mark Murphy
26 Aug 2011, 9:08 AM
Hi ,
first time posting.

I'm also getting the same error while using the loadData() method:
<ext namesspace>.dstore.loadData(newData, false);

newData =
{"ratio_results":[
{"total_student_time":16200,"total_tutor_time":3600,...{"total_student_time":10800,"total_tutor_time":8100,...
]}

any ideas?

thank you.

mark

skirtle
26 Aug 2011, 9:49 PM
Please enclose code in code tags (# button on the editor toolbar).

I don't see anything obvious wrong with what you're doing. Could you post the config for the store/reader? The stacktrace would also be useful, either from Firebug or the Chrome console.