0

So the title is a little confusing, I think, but here's the issue:

I have one model for my entire page called FD.page. I have an attribute of that model called filters, thus FD.page.get("filters") returns an object with multiple attributes itself, date, location, etc.

I would like to be able to set values to the attributes of the filters attribute, and I can't seem to figure out how to specify that node.

So something like FD.page.set("filters.location", "close");

Any help will be much appreciated. Thanks!

2 Answers 2

1

Make filters a backbone model

FD.page.get('filters').set('location', 'close');

Will fire change event.

Sign up to request clarification or add additional context in comments.

1 Comment

That's it. Sweet. Not sure why I didn't think of that. Thanks!
1

try FD.page.get('filters')['location'] = 'close';

This won't fire a change event on the model though. If you want to fire the change event, then you'll have to fire it manually after you set it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.