dart-webui

Using jqrangeslider with dart js-interop does not work

旧时模样 提交于 2019-12-11 18:37:55
问题 I am trying to use the jqrangeslider ( http://ghusse.github.io/jQRangeSlider/index.html ) in my web_ui app and it is not working. In my application main root dart file I have: void main() { js.scoped((){ js.context.jQuery("#slider").bind("valuesChanged", new js.Callback.many((e, data) { fromRange = data.values.min; toRange = data.values.max; })); }); main root html file I have: <script src="jquery.min.js"></script> <script src="jquery-ui.custom.min.js"></script> <script src="jQRangeSlider-min

How do you create an observable derivative property in Dart / Polymer Dart?

爷,独闯天下 提交于 2019-12-11 06:46:19
问题 I have a component that I want to bind a different css class to based on a boolean value. I have the following in my component code: bindCssClass(div, "open", this, "task.isOpen"); bindCssClass(div, "closed", this, 'task.isClosed'); Where isOpen / isClosed are defined as the following: @observable bool isOpen = true; get isClosed => !isOpen; The question is, how can I get isClosed to be observable, but based on changes to isOpen? I'd like to know this case, but also for cases that are more

Dart Client HttpRequest error/authentication handling

那年仲夏 提交于 2019-12-11 03:38:59
问题 I have a Dart client and a Java backend. I'm trying to add security around my application, so the Java server requires the user to be authenticated before accessing data. If a webservice call comes in and the user is not authenticated the backend services send a redirect with a HttpResponseCode (401) back to the client call. I have it now that the client can parse the request.status and see the 401 but it doesn't handle the redirect. Dart Code HttpRequest request=new HttpRequest(); request

Dart Web UI - Passing object data to a component

心已入冬 提交于 2019-12-11 03:15:16
问题 I am trying to pass data to custom component. The example at http://www.dartlang.org/articles/web-ui/#pass-data-to-component works good. But I'm trying to pass a JsonObject var, and it crash with this message: Exception: type 'String' is not a subtype of type 'JsonObject' of 'value'. So it seems like I can pass only strings and numbers data? 回答1: This works for me when passing the Map class. Perhaps you could change your code to use the dart:json library and the core library Map class, rather

Can Dart bind to id attribute?

假如想象 提交于 2019-12-11 03:02:03
问题 I need to generate a list of radio button inputs from a List , and to link the <label for="xx"> tag to the <input> , each needs its own id. But it seems Dart cannot bind to an id attribute: <div id="{{s}}"> <p id="text">{{s}}</p> <!-- Works as expected --> </div> The above results in the error: Error: line 40 pos 22: illegal use of class name 'DivElement' autogenerated_html.DivElement __{{s}}; So my question is: Can Dart bind to an id attribute, and if so how? And an alternative question: Is

How to change Element innerHtml to Dart SDK 0.7.1

拥有回忆 提交于 2019-12-07 11:12:34
问题 I am using dart-message https://github.com/mkozhukh/dart-message. It has function ... MessageBox(String text, String header, String css){ _box = new DivElement(); ... _box.onClick.listen(_clickHandler); if (header != null) html.write("<div class='dhtmlx_popup_title'>$header</div>"); html.write("<div class='dhtmlx_popup_text'><span>$text</span></div>"); html.write("<div class='dhtmlx_popup_controls'>"); } String addButton(String text, String result){ if (html != null){ html.write("<div class=

Dart library layout with Web Component

不羁的心 提交于 2019-12-06 16:48:20
My program was working fine until it became necessary to build a library that used a custom web component. I can't understand what Dart is complaining about. It gives a warning saying it "cannot resolve my_library" which leads to the error, "No such type WebComponent". I based my attempt on this . Here's my code: myapp.dart: library my_library; import 'dart:html'; import 'package:web_ui/web_ui.dart'; part 'fancyoption.dart'; void main() { // Enable this to use Shadow DOM in the browser. //useShadowDom = true; } myapp.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sample app<

How to change Element innerHtml to Dart SDK 0.7.1

北慕城南 提交于 2019-12-05 16:26:23
I am using dart-message https://github.com/mkozhukh/dart-message . It has function ... MessageBox(String text, String header, String css){ _box = new DivElement(); ... _box.onClick.listen(_clickHandler); if (header != null) html.write("<div class='dhtmlx_popup_title'>$header</div>"); html.write("<div class='dhtmlx_popup_text'><span>$text</span></div>"); html.write("<div class='dhtmlx_popup_controls'>"); } String addButton(String text, String result){ if (html != null){ html.write("<div class='dhtmlx_popup_button' result='$result' ><div>$text</div></div>"); } else throw new Exception("

Defining a global filter/transformer in Polymer.dart

那年仲夏 提交于 2019-12-05 06:53:47
Is there a way to define a global transformer that will be available in all custom elements? I'm not aware of a global way to define a transformer, but I use the following workaround: I have a class containing my global transformers, that are included into my custom elements using a mixin. Put it into a library that you include into every element. My global transformer mixin: abstract class GlobalTransformersMixin extends Object implements Observable { @observable final Transformer asInteger = new _StringToInt(); //... } Using it in an custom element: @CustomTag('my-elment') class MyElement

Making a Map or a List observable in Web UI

喜你入骨 提交于 2019-12-04 03:32:01
I can make a String or a num type observable by using the @observable declaration in the Dart code: @observable var x = ''; and {{ }} syntax in the html: <div>x = {{x}}</div> But @observable does not work with Lists and Maps. How do I make those observable? Use toObservable() with the List or Map as an argument. This creates a binding between the List or Map object and its representation in the UI. The following example uses toObservable() . Notice that the List and Map objects have data added to them every second. With toObservable() creating the proper binding, the UI for these objects auto