[英]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.