Skip to content

Commit

Permalink
fix #203
Browse files Browse the repository at this point in the history
  • Loading branch information
smaiLee committed Apr 3, 2018
1 parent 253e5ac commit 7d58da9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 44 deletions.
3 changes: 3 additions & 0 deletions dropins/README.md
Expand Up @@ -113,6 +113,9 @@ Triggered if an item value has been changed. Variable `response` contains value
Triggerd after the seconds defined in the attribute `data-repeat` on widget's html.
* `_events: { }` *(optional)*
Collection of any browser or jQuery Mobile event to be bound on widget's HTML node.
* `_allowPartialUpdate: true` *(optional)*
If this is set, the `_update` method can receive (after first intitialisation) new points of a series separately and without checking if all other items do have a value. (This replaces the former `point` event.)


## Icons
You may place your black icons in `icons/sw/` and their white counterpart in `icons/ws/`.
Expand Down
12 changes: 6 additions & 6 deletions lib/base/base.js
Expand Up @@ -1336,7 +1336,7 @@ var widget = {

$.mobile.activePage.find('[data-item*="' + item + '"]').filter('[data-is-sv-widget]').trigger('update', [item, value]) // new jQuery Mobile style widgets
.end().filter(':not([data-is-sv-widget])').each(function (idx) { // Old-style widgets
console.warn('Old plane smartVISU widgets are deprecated. Use a jQuery widget based on $.sv.widget instead.', this);
console.warn('Plain old smartVISU widgets are deprecated. Use a jQuery widget based on $.sv.widget instead.', this);

var items = widget.explode($(this).attr('data-item'));

Expand Down Expand Up @@ -1864,13 +1864,13 @@ $.widget("sv.widget", {
update: function(values, item) {
if(this.allowPartialUpdate && item != null) {
if (values !== undefined) {
var value = new Array(this.items.length);
value[this.items.indexOf(item)] = values;
this._update(value);
var partialValues = new Array(this.items.length);
partialValues[this.items.indexOf(item)] = values;
this._update(partialValues);
}
}
else {
if(values === undefined) {
if(values === undefined || item != null) {
values = widget.get(this.items);
}
if (widget.check(values)) {
Expand Down Expand Up @@ -1899,7 +1899,7 @@ $.widget("sv.widget", {
},

_write: function(value, itemindex) {
io.write(items[itemindex || 0], value);
io.write(this.items[itemindex || 0], value);
},

_update: $.noop
Expand Down
38 changes: 0 additions & 38 deletions widgets/basic.js
Expand Up @@ -7,44 +7,6 @@
* -----------------------------------------------------------------------------
*/

/**
* Class for controlling all widgets.
*
* Concept:
* --------
* Every item has a name. The value of the item may be of type: int, float, or
* array. The items are stored in the widget.buffer. The drivers will fill the
* buffer through the widget.update (and therefore widget.set). Asynchronly
* all widgets on a page may be updated. The update is been triggerd from
* widget.update, if a item has been changed. Updates are only made if all
* items are in buffer needed for that update. If one is missing the update is
* not been made. If some plots placed on the page, the update will look if it
* is possible to add only one point (if the widget is already initialized).
*
* Events:
* -------
* Some new events are introduced to control the widgets and there visual
* appearance.
*
* 'update': function(event, response) { }
* Triggered through widget.update if a item has been changed.
*
* 'draw': function (event) { }
* Triggered only for svgs, if it is loaded
*
* 'point': function(event, response) { }
* Triggered only for plots through widget.update if the plot is already drawn
* and only a new point has to be added to the series.
*
* 'repeat': function(event) { }
* Triggerd after the specified time, when 'data-repeat' ist been used.
*
* 'change', 'click' ...
* Standard jquery-mobile events, triggered from the framework.
*
*/


// ----- basic.checkbox -------------------------------------------------------
$.widget("sv.basic_checkbox", $.sv.widget, {

Expand Down

0 comments on commit 7d58da9

Please sign in to comment.