jsviews | Interactive data-driven views | Model View Controller library
kandi X-RAY | jsviews Summary
kandi X-RAY | jsviews Summary
JsViews builds on top of JsRender templates, and adds data-binding and observable data, to provide a fully-fledged MVVM platform for easily creating interactive data-driven single-page apps and websites.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of jsviews
jsviews Key Features
jsviews Examples and Code Snippets
Community Discussions
Trending Discussions on jsviews
QUESTION
I'm writting some web components and I'd like to use jsViews $.link functionality as my templating engine. I've been able to use $.render to replace the .innerHTML of shadowRoot cloned content but I've only been able to use $.link in the following way. Just seems "dirty" to have to add an extra div to link to. Is there a better way to do this? Are there any performance issues here?:
...ANSWER
Answered 2020-Nov-14 at 00:25Here is possible approach, as shown in this modified version of your sample: https://jsfiddle.net/BorisMoore/z9wnyh5q/.
Instead of defining the templates as content of script elements, they are defined using markup strings - to keep the HTML markup for the webcomponent itself.
QUESTION
I want to update input field externally (via jQuery) and I expect the associated object to be updated too, like I just typed the value into the input field by hand.
Here is my html:
...ANSWER
Answered 2020-Oct-11 at 05:03The difference in the behavior is because early versions listened to the change
or keydown
events on s for triggering observable changes to the data. Subsequently the HTML5
input
event became available, and was the preferred event for responding to any change in the value. Later versions of JsViews use the
input
event.
Calling $('#title').val('Hello').change();
will raise a change
event, but will not raise the input
event.
You can instead raise the input
event directly, by using:
QUESTION
I am using JsViews to design a template. However I wonder if we can groupBy an attribute based on its string value?
JSON sample:
...ANSWER
Answered 2020-Sep-24 at 05:00JsRender/JsViews {{for}} and {{props}} tags have built-in support for sorting, filtering etc, but don't have a built-in groupBy feature. But you can fairly easily create one, following similar techniques to the grid with ~total() sample.
Here is an approach using helper functions:
QUESTION
JSRender/JSViews templating engine renders JSON objects as follows:
...ANSWER
Answered 2020-Aug-13 at 15:37There is nothing wrong with your example. Did you try it? You are allow to access nested properties.
Please read the documention: https://www.jsviews.com/#paths
QUESTION
I have a template which renders a background image to CSS within a
style="background-image: url({{>~facilityImagePathDisplay(#data)}})"
Visual Studio doesn't like this and it's not a big deal but I wanted to see if there was a proper way to do this. I read through the documentation. Other stack questions and the below was created based off of the docs. This specifically links to all the docs Logic in JsViews css-tag
The above statement outputs exactly this to the div.
ANSWER
Answered 2020-Jun-18 at 22:18It depends if you are running the link()
method of JsViews, or simply the render()
method of JsRender.
Your first version will works in both cases, but is simply rendering the CSS style.
The second version would only be used if you are running the link()
method of JsViews - for data-binding etc. (So the background image could be dynamically updated if you data-binding triggers a new value).
For the data-link version, you need to makes sure the helper is returning a string that is not just "someUrl"
, but "url(someUrl)"
- to provide the correct CSS data url syntax. In that case, the following should work:
QUESTION
Just looking at the live example code on the jsViews site: https://www.jsviews.com/#jsvfortag@jsvsortfilterrange
If I modify this line to include a sort:
...ANSWER
Answered 2020-Apr-28 at 05:10The sorting does refresh when there is an array change event. Putting sort='name'
will re-sort if you click on [Add], or on [x] to delete an item. But what you want it is to trigger a re-sort whenever you change the name property in an item.
But you don't want it to re-sort on character entry, so the first thing is to set:
QUESTION
Not working as expected, returns the previous value, not the updated/changed value.
When using jquery to get the same changed value, it does return the updated/changed value. I was expecting the same from jsviews.
The data-link {:value:} does update both ways of course...but ultimately I need to grab the the 'text' value from the selected option to update elsewhere using setProperty(). Note: options are wrapped in a {{for...}}
Can see issue here: https://jsfiddle.net/alnico/h50jyd7o/
UPDATE:
I thought on 'click'/default event worked as expected...I was wrong.
It fires on both the select AND the option when each is clicked. I suppose that is the 'expected' behavior for click. However...
When passed to a helper, the select button returns the current value...then when option is clicked the changed value is returned. This is not good as the function would have to ignore the first click on select.
So, to add to my original post above...change fires 1 time, once an option is selected as expected, but...
Jquery returns the changed to value while Jsviews returns the current/previous value.
It seems to me that jsviews is not handling 'change' correctly for a select element?
ANSWER
Answered 2019-Nov-14 at 12:46Event - change
is working correctly. First, updated DOM next update observable object. Event change
happens at the moment the DOM changes (before update observable object) therefore the object is immutable.
Take away value
from {on 'change' ~updateValue }
then the dom event itself will disappear into the function.
You can turn to the conclusion like this:
QUESTION
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 which I have already made a few pages with and so far I like it very much but then I started looking at what others are doing and what the most popular frameworks are for doing these type of things not having used anything like this before.
The top frameworks (in 2019) seem to be React, Vue, and Angular. I read extensively about each and have decided that Vue is the best for me out of these three but now I wonder what is the advantage of using a less popular library like JsRender. For those of you who have chosen to use JsRender over the others, what made you choose it and what advantages might it have over the three mentioned above?
...ANSWER
Answered 2019-Aug-02 at 08:33We use JsViews for our project. We rejected angular and react because we required something slim that would not intervene with our existing asp.net webforms application. Perhaps you've heard "it's the Angular way or the highway". JsViews does this perfectly fine. Vue would probably also have worked for this application.
You'll likely be able to do all you want with any of the frameworks so that's probably a tie.
As for support and bugfixes: JsViews is second to none. We have ran into a couple of issues. All have been fixed in a day or so. The creator is very passionate about this framework. Honestly I think it's easier to get fixes from a smaller framework.
There is going to be more code out there for the big frameworks foresure but I personally don't consider that a big problem. We use bootstrap for our project so most stuff is just writing the correct markup. Where we need to generate said markup dynamically and/or need scripts we encapsulate that stuff in a reusable tag (think component). It means writing some code yourself yes but in my experience reusing someone elses components often leads me to lack features or looks and I'll often spend more time trying to configure that component than it would have taken me to write a custom component myself.
Documentation for JsViews is very complete. Lots of examples too. Vue also has pretty complete documentation and good community support.
I use Vue as well for an other project and it's pretty similar to JsViews in terms of features but I still think JsViews is more powerful once you get to know it and I like JsViews templates more than Vue templates. Also in Vue I feel I have to "configure" my viewmodels more to suit Vue wheras in JsViews I just hand it my viewmodels. In particular I really like the concept of helper methods and converters to separate the view from the model. Basically JsViews feel like a subset of WPF which I personally like.
I feel the basic concept of JsViews is very easy to learn: data bindings, converters, helpers, etc.. Custom tags is somewhat more complicated but not overly so.
If I had to choose a popular framework I would have picked Vue but personally I feel JsViews is more powerful. In case it makes you feel any better my bet is that all these frameworks will be superseded by something else so you might not want to focus blindly on popularity :)
QUESTION
I'm trying to develop my UI5 application using JSViews. I want to use the manifest.json file to define the rootView, but I'm not sure where I am supposed instantiate sap.m.App
, sap.m.Page
and then where to call sap.m.app:addPage
& sap.m.app:placeAt
to render it.
I used https://github.com/SAP/openui5-sample-app as a point of reference on how to construct the application (which is using XML views instead of JS Views)
In the first tutorial I followed, I created the app & page right in index.html like this:
...ANSWER
Answered 2019-Jul-17 at 12:41For security reasons, index.html should not contain code anymore (except the bootstrap script). This is somewhat new, therefore you will find a lot of tutorials which place something like a Shell-Container or, as in your example, a Page directly to the html body.
In your main view, you have to use the mandatory function "createContent" from which you have to return what should be rendered. Here is the basic implementation of a JS View:
QUESTION
I would like to define a unique id, for a html element, that I will have to pass as a parameter of a helper function.
The unique Id is generated correctly with the another helper function (genearteUniqueId) but I can't get it stored in a variable to reuse it and pass it to another function. Does anybody have run into this challenge when using Jsviews?
I tried assigning the generateUniqueId() result to a defined variable as in {{:uniqueId=~generateUniqueId()}} and then pass the uniqueId variable as a parameter {{:~decorator(uniqueId}} but it didn't work.
...ANSWER
Answered 2019-Jul-05 at 22:34Well you can define your own getUniqueId() which gets the last generated id, along the lines of
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jsviews
It can be installed with Bower, using $ bower install jsviews
It can be loaded using an AMD script loader, such as RequireJS
For installation using Node.js (npm), and loading using Browserify or webpack, see JsViews as a Browserify module and JsViews as a webpack module
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page