javascript - Filtering data-foreach rendering view with option dropdown, BatmanJS -
I simply try to manipulate a populated table by Batman JS to filter the entries with a dropdown option box I am doing
(html view code)
& lt; Select Data-Bind = "Itemview" & gt; & Lt; Option Data- foreach-item = "items" data-bind = "item.key1" data-bind-value = "item.key1" & gt; & Lt; / Options & gt; & Lt; / Select & gt; & Lt; Table & gt; & Lt; Tr class = "key" & gt; & Lt; Th class = "label" data-bind = "keys. Key1" & gt; & Lt; / Th & gt; & Lt; Th class = "label" data-bind = "keys .key2" & gt; & Lt; / Th & gt; & Lt; Th class = "label" data-bind = "keys .key3" & gt; & Lt; / Th & gt; & Lt; / TR & gt; & Lt; Tr class = "item" data-foreach-item = "items" & gt; & Lt; Td square = "name" data-bound = "item.key1" & gt; & Lt; / Td> & Lt; Td square = "number1" data-bound = "item .key2" & gt; & Lt; / Td> & Lt; Td square = "number2" data-bind = "item .key3" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; I have lost a lot from the point of view of this problem. My initial thought was to use coffeescript to select 'item' elements and declare it as "Display: None",
and coffeescript filterView => - obsolete = obj.options [obj.selectedIndex] .value; temp = document.getElementsByClassName ("item") temporary name For element = getElementsByClassName ("name"). InnerHTML not selected the name if the element element.style.display == "none" But I stuck at this point slightly, I'm wondering if there is any way to handle it with Batman Filters. / P>
Using the data-protected binding Item1key is selected. When you select an item from the dropdown, its key1 is item value , so that you may be able to check for: & lt; tr data-foreach-item = "items" data-showif = 'item .key1 | equals object | ue '& gt; & lt; td class = "name" data-bound = "item.key1" & gt; & lt; / td & gt; & Lt; Td square = "number1" data-bound = "item .key2" & gt; & Lt; / Td> & Lt; Td square = "number2" data-bind = "item .key3" & gt; & Lt; / Td> & Lt; / TR & gt; (My experience is that you have to be careful with non-string in the domes when they
Comments
Post a Comment