javascript - Selectize.js custom rendering with static html -


I am using the great selectize.js library to create an attractive selection box with option groups. It's all working, but I am stuck in the fact that I can not use a custom renderer from the example page (email contact) because "item" is not aware of the "email" attribute I know how to do it in javascript Is, but how can I define two attributes in static HTML?

In JS, this wish

  $ ('# id'). Select ({... option: [{name: "Martin", email: "martin@asdf.at"}], ....}   

I tried the following :

  & lt; select & gt; option value = "Martin Martin @ ASDF.At" data-name = "Martin" data-email = "Martin @ ASDF .ttt; Martin & lt; / option & gt; & lt; / select & gt;   

but this is not working ... finally taken from the examples Function:

  Render: {item: function (item, escape) {return '& lt; div & gt;' + (item.name? '& Lt; span class = "name" & gt; '+ escape (item.n Ame) + '& lt; / span & gt;': '') ('items mail?' 

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -