开发者

How to create a JS object representing a Car object that contains the business object and its graphical representation ( a jquery DOM element)

I'm currently developing some UI components with jquery and jquery UI and these graphical objects, lets say its a Car will have a graphical part and also a business object attached to it, that will be sent back and forth to the server, reflecting the current values of it upon resizing, moving, removing, etc from the browser.

Does anyone can please point me out how should i achieve this? Shall i create a javascript object that contains 2 objects inside, one representing the object with properties (width, height, weight, color) and other with the macthing Jquery object that represents this instance of the object in the DOM?

Can anyone point out an example and give a quick explan开发者_如何学Goation what are the best practices/approach to achieve this representation?

Thanks a lot!


You need to take a look at Backbone. It does exactly what you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜