使用最新的Tabulator 4.4版本。 我需要触发一个事件,以便可以捕获有关从一个表移动到下一个表的行的信息。 此举在浏览器中运行良好,但从来没有触发任何事情,至少我可以看到,这告诉了我什么举动。 我已经尝试过
drawer: Drawer(
child: Container(
color: drawerBackgroundColors,
child: StreamBuilder(
stream: newsBloc.allTopic,
builder:
(BuildContext context, AsyncSnapshot<List<Topic>> snapshot) {
print('newsBloc.allTopic ${newsBloc.allTopic}' );
print('snapshot data ${snapshot.hasData}');
if (snapshot.hasData) {
print('snapshot topic ${snapshot.data.length}');
return ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
return Container(
decoration: BoxDecoration(
color: childMenuBackgroundColor,
border: Border(
bottom: BorderSide(
color: Colors.white,
)
),
),
padding: EdgeInsets.all(2),
height: 50,
child: ListTile(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TopicsNewsScreen(
parentTopic: true,
topicId: snapshot.data[index].topicId,
topicName: snapshot
.data[index].topicName
.toUpperCase())));
},
title: Text(
snapshot.data[index].topicName,
style: childMenuStyle,
))
);
},
);
} else if (snapshot.hasError) {
return Text(snapshot.error.toString());
} else {
return Center(
child: CircularProgressIndicator(),
);
}
},
),
),
),
但是它永远不会发生。我尝试了发送者和接收者。 我有一张桌子,上面有所有可能的问题,还有一张只包含拖到上面的特定问题。
rowMoved:function(row){
//row - row component
}
也尝试了customReciever,也没有运气。它从未触发。
我确定可以做到,我只是想办法。
任何帮助都将不胜感激。
答案 0 :(得分:0)
看起来您的thistemplatequestions
的制表符定义与movableRowsReceiver
重复。删除第二个(movableRowsReceiver: "insert", //add rows when dropped on the table.
),然后您的customReceiver
将被执行。
编辑:
根据制表器文档:
注意:必须在两个表上都启用movableRows选项才能移动 一排到另一排。
在movableRows: true
制表符定义中似乎缺少thistemplatequestions
。
以下是根据您的代码片段,以及为使工作正常而进行的修改:
var thistemplatequestions = new Tabulator("#thistemplatequestions", {
...
movableRows:true,
movableRowsReceiver: customReceiver,
...
});
function customReceiver(fromRow, toRow, fromTable){
//fromRow - the row component from the sending table
//toRow - the row component from the receiving table (if available)
//fromTable - the Tabulator object for the sending table
console.log("New Row Received!");
this.table.addRow(fromRow.getData(), undefined, toRow);
return true;
}