Renee asks should all the locations be listed in the sidebar all the time,
should the list of locations depend on the user input?
Or should my model have my locations and that is that?
>> Good questions to boot, so the list you should
have all the locations when nothing's been searched for you.
When you begin searching for something,
that's when the the list view begins filtering.
So the list of locations will depend on what the user is searching for.
So like in my example, when I searched for sushi,
it filtered out all the restaurants that didn't have sushi either in the name or
you can also maybe get creative and add categories for
all your places and you can filter through the categories, as well.
Whatever you're searching for,
that's the only thing that should show up in the list view.
So your list you write is getting information from your model.
Your search is basically looking through your model to figure out what to turn on
and off.
And your map is looking at your model to decide where to put markers.
So the models kind of control controlling the models kind of what's
deciding what gets populated and everything and what
everything sort of filtering through >> That's more like,
what are the data that is required for my application so
the model decide your content of the application?
So list is a chosen subset of model and markers are a matching subset of model.
>> The list in the markers should be the same subset of the model.
So when I search for something
my markers are reflecting that search as well as the list view.
So anything that disappears on my list view is also disappearing on my markers.
To think of it like, if you had a Google Map and it had a markers, you search for
a restaurant that gave you all the markers all the restaurants, and
then you search for burger restaurant and
the like half of those markers would go away.
And they would just be the burger restaurants left.
And then, right on your list you'd have a big list of restaurants.
And then when you major filter a little bit stronger,
put it like burger restaurant, that would filter down as well.
>> Yeah, so to follow her question so she asked,
and what are set by the search?
Yes, actually your list and your markers are set
by your search function, whatever you search has to show up on your list,
has to reflect on your markers, as well.
The result of your search function and sometimes the list might have 1 or
2 things listed and other times 10 or 15 depending on the search.
Exactly, that's right.
When you're not searching for anything, you can show all the places that
you have actually displayed in your mouth.
When you're searching for something you might focus that
list into a subset of whatever the keyword.
Or the character that you are entering.
And this should reflect in your markers, as well.
In addition to Knockout can be used jQuery UI
widgets such as the autocomplete widget.
>> Yeah, you can feel free to use the jQuery UI widgets.
Just make sure that you kind of understand what's going on with like
what the autocomplete which is actually doing,
is it can get a little tricky when there's some functionality built into it
that you don't really know about.
But I don't see any problem with using those along with Knockout.
But we do require that you use Knockout so try not to rely too
much on sort of pre-built widgets and things like that.
You can actually, that's actually really, really simple.
Fortunately, Chrome makes debugging and
testing all aspects of your site really easily.
If you actually go into your developer tools, there's a little emulator
icon and in here you can emulate like a bunch of different devices.
So this is a great place to test things like responsiveness and
making sure it displays well on different devices.
And Chrome is usually pretty good about making sure these devices are up to
date, but next to this sort of Device tab is also a Network tab.
And in here there's all sorts of options, so I can sort of test how my
website is going to load on tons of different sort of connection speeds.
And one of them happens to be offline, so if I wanted to test what happens
if my website is trying to be accessed offline, or I can refresh and see like,
God, nothing loads because I'm offline and I'm trying to reach Google Maps.
Or I can test it on Wi-Fi and see everything loads really quickly.
You can also do other kinds of throttling like just testing it on
your local connection.
Good, regular, dial-up whatever.
So this is a really cool suite of tools that Chrome has developed for us.