juco
juco

Reputation: 21

jQuery tmplItem.update() clears nested template data?

I have a parent template with a nested template. When I select and change a tmplItem value from the parent template and call .update(), it seems to clear all data from the nested template?

Crude example paste here: http://pastebin.com/cjDKmmyU

Upvotes: 2

Views: 3044

Answers (2)

Jai Kumaresh
Jai Kumaresh

Reputation: 835

My solution is to update your template element data attribute value with lodash.

// $this is your template element
_.set($this.data(), 'tmplItem.data.value', 'new value');

Then get your template element value from that data attribute with lodash. For example,

_.get($this.data(), 'tmplItem.data.value');

Upvotes: 1

RP Niemeyer
RP Niemeyer

Reputation: 114792

Here is a working sample based on your paste: http://jsfiddle.net/rniemeyer/pK8ye/

Is there something different that you are doing in your project?

Upvotes: 0

Related Questions