jsviews

Logic in JsViews css-tag

大憨熊 提交于 2021-01-29 11:13:03
问题 I am trying to put logic in a css-width in a data-link in jsViews. The two following approaches did not work: {{for Items}} ... <td id="show-keys" data-link="css-width{~root.ShowKeys ? '200px' : '400px'}"> or {{for Items}} ... <td id="show-keys" data-link="css-width{:~keysWidth()}"> ... <script type="text/javascript"> ... var app = { ... helpers: { showKeys: function () { //debugging shows that this never gets fired return app.ShowKeys ? '400px' : '100px'; } How do I appropiatly base a css

View not updating on observable changed

只愿长相守 提交于 2020-01-06 02:49:11
问题 I'm trying to have a list be rerendered when the container of the list is updated: {^{for selectedScenario.instances}} <div>{^{:name}}</div> {{/for}} When I use $.observable(data).setProperty("selectedScenario", scenario), nothing changes. In http://jsfiddle.net/ep76m4af/1/ you can see this in action. ObserveAll shows that the data itself is updated and the event is properly fired. 回答1: The reason it is not working is because you are using a 'deep path' selectedScenario.instances - which by

D3.js Graphs in JavaScript Templates (jsRender/jsViews, jquery tmpl, etc.)

南楼画角 提交于 2019-12-25 15:03:43
问题 I've been trying to create a page that uses JavaScript Templates which incorporate graphs made using d3.js to display information about each inventory item (in this example, I have an array of JSON blobs containing transistor data.) For example, I need boilerplate "Absolute Max Ratings" table followed by graphs like the impedance curve for a range of Gate Voltages. Here's what I have so far: var partData = [ { name: "IRF10", maxRatings: { vds: 200, vgs: 20, id: 2.1, pd: 36 }, impedanceGraph:

D3.js Graphs in JavaScript Templates (jsRender/jsViews, jquery tmpl, etc.)

五迷三道 提交于 2019-12-25 15:03:36
问题 I've been trying to create a page that uses JavaScript Templates which incorporate graphs made using d3.js to display information about each inventory item (in this example, I have an array of JSON blobs containing transistor data.) For example, I need boilerplate "Absolute Max Ratings" table followed by graphs like the impedance curve for a range of Gate Voltages. Here's what I have so far: var partData = [ { name: "IRF10", maxRatings: { vds: 200, vgs: 20, id: 2.1, pd: 36 }, impedanceGraph:

JsRender/JsViews vs other template based frameworks [closed]

♀尐吖头ヾ 提交于 2019-12-24 10:48:58
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 months ago . Have been using Microsoft's Ajax framework for years to make single page applications with the division of UI render work around 50% client, 50% server. Want to move to 100% UI client side rendering and was looking for a templating engine. I recently found JsRender/JsViews

How to keep helper function generated HTML tags for JsViews

≡放荡痞女 提交于 2019-12-13 16:26:18
问题 In JsRender[1] I have the custom tags {{tag data /}} to generate part of my page. According to http://borismoore.github.com/jsrender/demos/step-by-step/03_converters-and-encoding.html it is possible to use {{:value}} to render HTML from value too. However in JsViews[2] where I need to put expressions in the data-link attribute of tag, if my conversion function generates HTML tags (say: <div data-link="{:~conv(data)}" /> where conv generates HTML tags function conv(data) { return '<b>' + data

Possible jsviews bug with {^{if}}

情到浓时终转凉″ 提交于 2019-12-13 07:23:16
问题 In the example below, if I add several guests and then remove the 1st guest the entire guest table disappears and never reappears even though the Guest[] in not empty. Is there something wrong with {^{if}} here or my code? (I'm using commit 34) <div id="frm-reg"></div> <script id='jsr-registration' type='text/x-jsrender'> <p><button id="btn-addGuest">Add Guest</button></p> {^{if Guests.length}} <table> <tr> <th>First Name</th> <th>Last Name</th> <th>Age</th> <th></th> </tr> {^{for Guests}}

custom variables in FOR with JsRender

心不动则不痛 提交于 2019-12-13 06:02:04
问题 I'm migrating from jQuery templates to JsRender and I don't know how to fully translate an {{each}} into a {{for}} With jQuery templates I could do something like this: {{each (i, val) object.items}} <span data-index="${i}">${val}</span> {{/each}} Where object.items is an array of values and I could define a custom index and item variables to show data (in this case i and val ). But how do I do the same thing in JsRender? {{for object.items}} <span data-index="{{:#index}}">{{:#data}}</span> {

I'm trying to build up options from an array data value using jsView

孤街醉人 提交于 2019-12-13 03:38:40
问题 if you have an array of items, without properties, how do you access the value inside a for loop? I currently get the right number of options, but I haven't found the correct syntax to get the value of the option. there's a working jsfiddle at: http://jsfiddle.net/geewhizbang/Y44Gm/4/ var data = { items: [{ "title": "First Drop Down", "hist": "Secondary", "dec": "Priority", "options": ["Priority", "Secondary"], "type": "select" }, { "title": "Second Drop Down", "hist": "Competitive Widget",

Summary Value Calculation with JsViews

心不动则不痛 提交于 2019-12-13 02:57:09
问题 I like to display two summary data on my page by using jsviews binding. The UI will be something like in screenshots. The user can add/remove the person from the list and it will affect the value of "No. Of People" and the user can edit integer value in textbox and the total values will be shown in "Total Amount." Yes. I managed to make it work .. Please see my code there. http://jsfiddle.net/michaelsync/eqhkzv3t/3/ But I think it's very ugly esp: this code below. function observeAmounts(){