繁体   English   中英

如何将 ag-grid(直播)连接到 lightstreamer?

[英]How to connect ag-grid (Live Streaming) to lightstreamer?

我想将 ag-grid 作为插座连接到 lightstreamer。 ag-grid支持吗?

我以前没有使用过 lightstreamer,但根据他们的文档,它看起来像是一种实时获取数据作为订阅的方式。

我已经在这里实现它作为您可以使用的起点,请参阅以下 plunkr

请注意,我在这里所做的只是在 Grid Event onGridReady 中添加了来自npm 页面的逻辑:

  onGridReady(params: GridReadyEvent) {
    var sub = new Subscription(
      'MERGE',
      ['item1', 'item2', 'item3'],
      ['stock_name', 'last_price']
    );
    sub.setDataAdapter('QUOTE_ADAPTER');
    sub.setRequestedSnapshot('yes');
    sub.addListener({
      onItemUpdate: (obj) => {
        const stockName = obj.getValue('stock_name');
        const lastPrice = obj.getValue('last_price');
        const newData = [
          ...this.rowData,
          { stock_name: stockName, last_price: lastPrice },
        ];
        this.rowData = newData;
      },
    });
    var client = new LightstreamerClient(
      'http://push.lightstreamer.com',
      'DEMO'
    );
    client.connect();
    client.subscribe(sub);
  }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM