Can't save form contents bound to datastore

I have a form bound to a DataStore with multiple records. The DataStore is connected to a DataProcessor component to deal with the server.
The cursor in the DataStore is set programmatically by clicking on a different tree component.
This all works - the form contents change when I select different tree elements.

However, I cannot find a way to save changes to the form - such a simple thing so I must be missing something:

I set the command attribute on the form’s button to save and attached an “onButtonClick” handler that gets called OK. But now I don’t know how to get the new form contents into the DataStore and then saved the the server.

I have the following code that generates an error as indicated in the comments:

	setDataStore(DATASET_WZ_PAGES);
	pagesForm_form.bind(getDataStore(DATASET_WZ_PAGES));
	

	pagesForm_form.attachEvent("onButtonClick", function(name, command){
		switch(command) {
		case("save"):
			var items = this.getFormData(); // Works OK
			var ds = getDataStore(DATASET_WZ_PAGES); // The DataStore		

			var id = ds.getCursor(); // Current position, Correct

			// Try to update the Store and send to server
			ds.set(id, items); // ERROR: "set" is not a function of this object

			var dp = getDataProcessor(DATASET_WZ_PAGES);	// The DataProcessor, already defined
			dp.setUpdated(id, true);
			dp.sendData();

			break;
	    }
	});

… there was a “set” function available in similar code for a different DataStore used for a DataView but not for this one for some reason.

What am I meant to do to save the changes? I hoped that the saving would happen automatically like it does with grids but I’ve not found that to be the case.

Thanks.

The simplest solution will be in calling

pagesForm_form.save();

which will push data from form back to datastore, and further to server side through dataprocessor.

If you want to update data manually, it can be done as

     ds.update(id, items);

Thank you - so simple!