kipsta
11-09-2004, 03:56 AM
Can anyone lend me a hand with a dataset issue... my forehead is sore from beating it against my monitor all night. ;)
Essentially the problem is I have a view which contains N instances of a custom class named 'Engine'. These engines are self-updating by querying data from a servlet. To get this 'working' properly (maybe working isn't the right word at the moment. :P ), I define the dataset in the oninit for the custom classes with the following code:
<method event="oninit">
var tmpDataset = new LzDataset("myDatasource", {name: 'engineDataset'});
tmpDataset.setSrc("/servlet/enginedata/getData");
tmpDataset.setAttribute('type', 'http');
tmpDataset.setQueryString({userID: queryUserID, engineID: queryEngineID});
this.engineDataset = tmpDataset;
this.setDatapath('engineDataset:/engine');
this.timerDelegate = new LzDelegate( this, "loadData" );
LzTimer.addTimer ( this.timerDelegate, 500 );
loadData();
enginePosition.select( enginePosition.currentPosTab );
</method>
This works beautifully if I have one instance of said class loaded, but if I have more than one, each one contains the same data and I get the following message in the debug window:
WARNING: a dataset already exists with the name 'engineDataset':LzDataset :engineDataset - use explicit datasources in your datapaths.
I tried defining a datasource inside the class object as well as creating one inside the oninit, but nothing seems to allow me to have unique data for each of these engine objects. I have to be doing something wrong but for the life of me I have no idea what.
If someone could help me, I'd be a very happy camper (and owe you a beer or something if you're in Boston ;) )
Essentially the problem is I have a view which contains N instances of a custom class named 'Engine'. These engines are self-updating by querying data from a servlet. To get this 'working' properly (maybe working isn't the right word at the moment. :P ), I define the dataset in the oninit for the custom classes with the following code:
<method event="oninit">
var tmpDataset = new LzDataset("myDatasource", {name: 'engineDataset'});
tmpDataset.setSrc("/servlet/enginedata/getData");
tmpDataset.setAttribute('type', 'http');
tmpDataset.setQueryString({userID: queryUserID, engineID: queryEngineID});
this.engineDataset = tmpDataset;
this.setDatapath('engineDataset:/engine');
this.timerDelegate = new LzDelegate( this, "loadData" );
LzTimer.addTimer ( this.timerDelegate, 500 );
loadData();
enginePosition.select( enginePosition.currentPosTab );
</method>
This works beautifully if I have one instance of said class loaded, but if I have more than one, each one contains the same data and I get the following message in the debug window:
WARNING: a dataset already exists with the name 'engineDataset':LzDataset :engineDataset - use explicit datasources in your datapaths.
I tried defining a datasource inside the class object as well as creating one inside the oninit, but nothing seems to allow me to have unique data for each of these engine objects. I have to be doing something wrong but for the life of me I have no idea what.
If someone could help me, I'd be a very happy camper (and owe you a beer or something if you're in Boston ;) )