Hi Sam,
hehe, the problem you pointed in your blog is the one that i going to
solve in 0.3
but I am not going to replace DOM with innerHTML, since as you said it
doesn't solve the problem entirely, and it would break compatibility
with interaction.js. I would rather create a datasource object that
holds the "master view" and maintain the "binding" to chained element
(remind that chain.js is not just plain templating engine, but rather
a binding & data management").
Rather than taffyDB i am going to create chain.js own datasource
object that mantain the binding to the item, so you can link your
element to a certain "collection"(view) in datasource, similar to
linking to other chain element. As design inspiration I take the WPF
data binding solution
http://msdn.microsoft.com/en-us/library/ms752347.aspx
What I want to achieve with datasource is to create a smart object
that at the same time maintain synchronity between server and client
(since data come in most of cases from server) and to the view (chain
object).
What I meant by smart is, that the view just have to create small
amount of items, and these items would be only created ONCE, then the
datasource bind them to the current collection/view. This collection
is a paged collection, which mean, if page is changed, the items would
NOT REGENERATED but only RELINKED to the next items. Using this, we
can create smart scroller, that means that we could modify the
scrollbar so that it doesn't scroll, but change the offset/page of the
datasource.
The advantage of this method is the small footprint since only small
amount of DOM objects would be generated and also we could create
dynamic data loading like yahoo mail. The Concept would be like this:
(it is a bit simplified, contact me for more detailed concept)
- datasource connect to the server (using Rest API) and request some
amount of data
- in this process datasource also gather some information about the
amount of items available and so on.
- datasource display it on chain object. Chain object create a
scroller that represent the whole data amount.
- To preserve responsibility datasource request more amount of data
than the view
- If user do some narrow scroll the data will displayed at once, since
datasource do some caching
- If user do long scroll (e.g. scroll to the end), datasource would
create dataItem object on the fly but with no real data and with
"loading"flag
- in this time datasource also performs a request for the current data
offset. When the data is available dataItem will get it and update the
view.
using this method it would be very simple to display hunderds to
thousands of data
I hope you understand why I am not really interested on TaffyDB and
why DOM is required. I hope you can see my direction.
Actually I this concept has been floating around my mind since I
designed chain.js for the first time (thats why I am commited to dom).
But I wanted to do it step by step (partly because lack of time) and I
want to produce a well designed & structured code (Well In My Opinion
the current design isn't too bad). So I spent rather more time on
conception than coding.
What do you think about this concept? If there are many who are
interested, perhaps we could discuss it more deeply.
regards, Rizqi Ahmad
On 23 Okt., 09:10, Relleum <
sjmuel...@gmail.com> wrote:
> Hey Rizqi, great job on the new release. I'd love to try it, but I
> have a heavily modified version of your code and it will take a while
> to implement version 0.2. I also wrote a blog entry about the
> changes I made, so please check it out:
>
>
http://samuelmueller.com/post/2008/10/20/Client-side-templates-using-...