Why is the getcursor and setcursor not available before binding the datastore to a component?
I would like to set the cursor, and afterwards open a form to show this datastore (and the record of the cursor). Is there a (better) solution than the workaround I currently use?
datastores = new Object();
datastores['item'] = new dhtmlXDataStore();
datastores['item'].load( 'connector.php' , 'xml' , function() {
console.log( 'Data loaded: ' + datastores['item'].dataCount() ); // Shows "2"
datastores['item'].setCursor( 1 ); // Uncaught TypeError: Object #<an Object> has no method 'setCursor'
console.log( datastores['item'].getCursor() ); // Uncaught TypeError: Object #<an Object> has no method 'getCursor'
});
WORKAROUND:
[code]var tmp = new dhtmlXDataStore();
datastores = new Object();
datastores[‘item’] = new dhtmlXDataStore();
datastores[‘item’].load( ‘connector.php’ , ‘xml’ , function() {
tmp.bind(datastores['item']);
console.log( 'Data loaded: ' + datastores['item'].dataCount() ); // Shows "2"
datastores['item'].setCursor( 1 ); // Works!
console.log( datastores['item'].getCursor() ); // Shows "1"
});[/code]