Templating outgroups with select2 - jquery-select2

I want to make all the outgroup labels bold when using select2 and loading the list via an array. My data looks like this:
[{"text":"Brands","children":
[{"text":"BlackBerry","id":"BlackBerry"}, {"text":"Campagnolo","id":"Campagnolo"}, {"text":"Canon","id":"Canon"},{"text":"FujiFilm","id":"FujiFilm"},{"text":"GoPro","id":"GoPro"},{"text":"Nikon","id":"Nikon"},{"text":"Shimano","id":"Shimano"},{"text":"Vans","id":"Vans"}]},
{"text":"Benchmarks","children"
:[{"id":"powertools","text":"Power Tools"},{"id":"shoes","text":"Shoes"},{"id":"clothing","text":"Clothing"},{"id":"camerasPhoto","text":"Cameras and Photo"},{"id":"healthBeauty","text":"Health and Beauty"},{"id":"electronics","text":"Electronics"},{"id":"homeGarden","text":"Home and Garden"},{"id":"sportingGoods","text":"Sporting Goods"}]}]
I don't see how to use the formatState function to select just the outgroup values Brands and Benchmark in this case and format them as bold.

Related

How to select polymer dart custom elements in a angular dart view

So, I'm trying to select a polymer custom element(using paper_elements) in my view with querySelector. I'm able to select regular html elements just fine. In particular, I'm trying to select a specific paper-input element. I want to be able to query it's input element which is buried in it's second shadowroot.
I've tried the following:
querySelector('#my-paper-input::shadow #input')
querySelector('paper-input::shadow input')
and a bunch of other variations. However, no matter what I do, the query always returns null. It's driving me mad because I can style it in css. What do?
As far as I know you have to use several steps
querySelector('#my-paper-input').shadowRoot.querySelector('input');
but you should also be able to access the value using the attribute of the outer element like
querySelector('#my-paper-input').attributes['value'] or
querySelector('#my-paper-input').attributes['inputValue']
you could also use http://pub.dartlang.org/packages/angular_node_bind
but I wasn't able using Angular with paper-elements recently (see https://github.com/angular/angular.dart/issues/1227)

Struts2 create dropdown dymamically based on first dropdown value in Struts2 using hibernate

Hi I am using Struts2 and hibernate now in my jsp I have Two dropdown ,on selection of first drop it should call a function and retrive the values for second drop down from the database
Please help
Well you have number of options here and some of them are
user struts2-jquery plugin which comes with this feature where you can create two dependable select.
user simple jquery with JSON (struts2 plugin) and use ajax.
i will prefer second approach which is much more flexible.create a custom JS function with help from jquery and when use select first option from drop down call your action methods which will send JSON data based on the selected values and use JQuery build in JSON parsing mechanism to parse the content and fill second drop-down.
a simple Google search will give you a number of results.

freebase autosuggest tags

I'd like to be able to use the same Freebase autosuggest plugin but with the added ability to add multiple entries to a single field separated by commas.
I know that they are using some variation on jquery-ui autocomplete but can't figure out how to do this using their modified JS. http://www.freebase.com/docs/suggest
Any ideas?
Or use something like Jquery Tag-it

using jquery templates in a loop, need to prefill input items with ViewBag.values

I have a jquery template that I'm looping over x number of times to repeat on a form. When that form is reloaded, it automatically runs the loop to display all of the inputs according to what was previously selected, but I can't for the life of me wrap my head around how to put the values into those fields.
using something like this:
(string)ViewBag.myFieldValue{id}
doesn't work because it thinks it's a c# object (obviously).
how can I accomplish this?
A jquery template needs a json object to render. So you should put the values from your viewbag into a json object. Even better, a template can also receive a json array, and will render x number of templates depending on the number of objects in the array.
Take a look at this blogarticle and you will figure it out soon:
An introduction to jquery templates

Raw HTML in Form Filter

At my company, we had developed a athletes management solution, were each athlete is inserted in the application by administrators users. For the referred solution, it was used the symfony admin generator.
On the second project iteration, one of the clients request was to turn the printed athletes list more legible. To accomplish that, we had created proper CSS styles, to be used when the user selects the browser print option.
However, the athletes form filter has some HTML tags (symfony widgets) whose do not render properly, namely, the select tag that has possible multiple choices (the select choices do not appear on the print preview).
So, I would to know if is possible to insert raw HTML directly on the form filter (get the selected options and convert them is labels or plain text), that will be only visible when the user selects the print option.
You could put a custom widget in place of the standard choice widget that adds in the values you want to be shown when printing but hidden with styles by default. Then you show them using your print style sheet.

Resources