You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature improvements:
- Major update for custom tags - including support for two-way binding to multiple
args and props
See samples: http://www.jsviews.com/#samples/tag-controls/jqui/draggable-droppable@jsv-draggable
and tests: http://www.jsviews.com/test/unit-tests-jsviews.html?testId=f46a512b
and also jQuery UI tag control samples such as http://www.jsviews.com/#samples/tag-controls/jqui/resizable
and http://www.jsviews.com/#samples/tag-controls/jqui/draggable-droppable.
Also many code examples in
https://www.jsviews.com/download/sample-tag-controls/jsviews-jqueryui-widgets.js
A tag definition can include:
tag.bindTo - which specifies two-way bound parameters (one or more args and/or
props)
tag.linkedElement - which specifies selectors for linkedElems for any of the
two-way bound parameters
tag.linkedCtxParam - which specifies/names tag contextual parameters for any of
the two-way bound parameters
mainElement - which specifies selector for an element used for setting id, width
or height (otherwise, linkedElem is used)
A tag onBind event can set:
tag.linkedElem
tag.linkedElems
tag.mainElem - which is the element used for setting id, width or height
(otherwise, linkedElem is used)
tag.displayElem - which is the element used for setting class (otherwise,
mainElem/linkedElem is used)
The following tag methods are available:
tag.bndArgs() - which returns array of 'external' bound parameters (after
convert, if convert=... is specified)
tag.update(...) - which observably updates any ('external') bound parameters
(using convertBack, if specified)
tag.setValue(...) - which sets tag itself to new ('internal') values of bound
parameters
tag.getValue(...) - which returns array of current ('internal') values of bound
parameters
New 'tag contextual parameters' feature - see samples and explanation:
http://www.jsviews.com/#samples/tag-controls/jqui/resizable and
http://www.jsviews.com/#samples/tag-controls/jqui/draggable-droppable@tag-ctxl-params
- Other custom tag improvements:
New 'tag boundProps' feature:
Tag definition can include: tag.boundProps - which specifies any additional props
that are bound, without needing ^myprop=... notation. See sample:
http://www.jsviews.com/#samples/tag-controls/range
New 'tag contentCtx' feature:
Tag definition can include: tag.contentCtx - which specifies the data context within
the tag block content.
Set contentCtx = true for inheriting parentView context, or to a function, for
specifying other context
New 'tag argDefault' feature:
Tag definition can include: tag.argDefault: false - which prevents the first arg
defaulting to current data
New 'tag onUpdate: false' feature:
Tag definition can include: tag.onUpdate: false - which is equivalent to an onUpdate
handler which does nothing but returns false, so tag does not rerender when bound
args or props update
- Major update for jQuery UI widget-based tag controls library:
Extensive new jQueryUI widget controls support and accompanying samples/documentation:
http://www.jsviews.com/#download/jqueryui-tagcontrolshttp://www.jsviews.com/#samples/tag-controls/jqui
- New lateRender=true feature: set lateRender=true on any tag, to make the tag render only
after completing the data-linking pass. Useful for using expressions such as
#childTags('myTag') in data-link expressions.
See tests: http://www.jsviews.com/test/unit-tests-jsviews.html?testId=6be4ff95
and sample: http://www.jsviews.com/#samples/tag-controls/jqui/selectable@late-render
- {^{on ...}} with no content allows setting width, height, id and class
Perf improvements for sorting, moving, refreshing:
- Much improved perf for {^{for myArray}}...{{/for}} when making observable changes to
underlying array. When using $.observable(myArray).refresh(...) or
$.observable(myArray).move(...), the resulting changes to the rendered items no longer
result in deleting and re-rendering the moved items. Instead the rendered HTML elements
are simply moved to their new positions under the parent element.
Bug fixes:
- #361: Breaking change (radiobuttons) - both
radiogroup and directly data-linked radio buttons now behave identically. Neither of
them coerce value to string
- Bug with setting tag.depends=... (Breaking change: Note that setting fn.depends="myArray"
updates for array changes as well as prop change. See:
http://www.jsviews.com/test/unit-tests-jsviews.html?testId=303f5bfd
- #354: Minor 'onError' bug
- #360: Datepicker bug fix for correct behavior
when data-linking to a value of type Date
- Several minor bug fixes
Unit tests:
- Several additional unit tests
Other minor breaking changes:
- The undocumented lazyLink feature has been removed
- The undocumented init: false feature for custom tags has been removed.
if(unobserve&&!l&&!root){// unobserve() - unobserves all
@@ -532,7 +540,6 @@ if (!$.observe) {
532
540
if($isArray(object)){
533
541
bindArray(object,unobserve,unobserve);
534
542
}else{
535
-
// remove onObservableChange handlers that wrap that callback
536
543
observeOnOff(ns,"");
537
544
}
538
545
}
@@ -544,9 +551,13 @@ if (!$.observe) {
544
551
if(path===""){
545
552
continue;
546
553
}
554
+
if(path&&path._ar){
555
+
allowArray+=path._ar;// Switch on allowArray for depends paths, and off, afterwards.
556
+
continue;
557
+
}
547
558
if(path&&path._cp){// Contextual parameter
548
-
contextCb=$sub._gccb(path[0]);// getContextCb: Get context callback for the contextual view (where contextual param evaluated/assigned)
549
-
origRoot=root=path[0].data;// Contextual data
559
+
contextCb=$sub._gccb(path[0]);// getContextCb: Get context callback for the contextual view (where contextual param evaluated/assigned)
560
+
origRoot=root=path[0].data;// Contextual data
550
561
path=path[1];
551
562
}
552
563
object=root;
@@ -585,7 +596,6 @@ if (!$.observe) {
585
596
// This is a compiled function for binding to an object returned by a helper/data function.
586
597
// Set current object on exprOb.ob, and get innerCb for updating the object
587
598
innerCb=unobserve ? path.cb : getInnerCb(path);
588
-
innerCb.noArray=!allowArray;
589
599
// innerCb._ctx = callback._ctx; Could pass context (e.g. linkCtx) for use in a depends = function() {} call, so depends is different for different linkCtx's
590
600
innerCb._cId=callback._cId;
591
601
// Set the same cbBindingsStore key as for callback, so when callback is disposed, disposal of innerCb happens too.
@@ -600,8 +610,6 @@ if (!$.observe) {
600
610
}
601
611
path=origRoot;
602
612
object=undefined;
603
-
}else{
604
-
object=path;// For top-level calls, objects in the paths array become the origRoot for subsequent paths.
605
613
}
606
614
}
607
615
parts=[root=path];
@@ -664,23 +672,21 @@ if (!$.observe) {
664
672
allPath+="."+prop;
665
673
}
666
674
prop=object[prop];
675
+
if(!parts[0]){
676
+
bindArray(prop,unobserve);// [un]observe(object, "arrayProperty") observes array changes on property of type array
677
+
}
667
678
}
668
679
if($isFunction(prop)){
669
680
if(dep=prop.depends){
670
-
// This is a computed observable. We will observe any declared dependencies
if(property!==value||nonStrict&&property!=value){// Optional non-strict equality, since serializeArray, and form-based editors can map numbers to strings, etc.
816
+
if((property!==value||nonStrict&&property!=value)
817
+
// Optional non-strict equality, since serializeArray, and form-based editors can map numbers to strings, etc.
828
818
// Date objects don't support != comparison. Treat as special case.
$_data.triggerHandler(arrayChangeStr+(self._ns ? "."+/^\S+/.exec(self._ns)[0] : ""),eventArgs);// If white-space separated namespaces, use first one only
0 commit comments