Returning Derived Object

Today I came across a small problem with SmartClient.

What I have done is…

dataSource.addData(new MyRecord(a));

here “MyRecord” implements Record and ‘a’ is a JavaScriptObject

On a double-Click event of list grid I have this code…

a2=listGridRecord.getJsObj();

This ‘a2’ looks similar to ‘a’. But it is not same. It is returning
new Object that is derived from ‘a’.

I am assuming that you are aware of data source and ListGridRecord
classes.

Why SmartClient is returning new Object. Why not original object?

Rajesh

Because you are allowed to have independent caches of data retrieved from a DataSource, and separately modify them. This is by design. If you need to associate data fetched independently by two different components, match via primaryKey value.