小部件嵌入到聚合物

小部件嵌入到聚合物

本文介绍了如何将handsontable小部件嵌入到聚合物dart webcomponent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将基于jquery的手机()ui小部件嵌入到聚合物飞镖webcomponent。

I try to embed the jquery based handsonetable (http://handsontable.com) ui widget into a polymer-dart webcomponent.

Webcomponent的定义如下:

The Webcomponent is defined like that:

<polymer-element name="my-table">
  <template>
    <div  id="table"></div>
  </template>

  <script type="application/dart" src="t.dart"></script>
</polymer-element>

t.dart:

import 'package:polymer/polymer.dart';
import 'dart:js';

var data = [
            ["", "VW", "BMW", "Mercedes", "Mini", "Mitsubishi"],
            ["2012", 2, 2422, 5399, 776, 4151]
           ];


@CustomTag('my-table')
class MyTable extends PolymerElement
{ MyTable.created() : super.created()
  { final element = shadowRoot.querySelector("#table");
    context.callMethod(r'$', [element])
      .callMethod( 'handsontable', [new JsObject.jsify({'data': data,
         'minSpareRows': 1,
         'colHeaders': true,
         'contextMenu': true})]);

  }
}

我没有错误,组件未初始化。
如果我尝试在main.dart,它工作正常。

I get no error, but the component isn´t initialized.If I try in the main.dart, it works fine.

该方法适用于jquery-ui小部件datepicker

The approach works for the jquery-ui widget "datepicker" How to embed a jquery ui widget into a polymer-dart webcomponent

推荐答案

看起来不像dart-to-js interop。

It doesn't look related to dart-to-js interop.

我可以在工作的家中提供示例与 dart:js ,但不在聚合物元素内。我怀疑handsontable与shadowDOM不能很好地工作。

I can make the example provided on the home of http://handsontable.com/ work with dart:js but not inside a polymer element. I suspect that handsontable does not work very well with shadowDOM.

这篇关于如何将handsontable小部件嵌入到聚合物dart webcomponent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 01:08