如何使用过滤器将数据表值存储在另一个数据表中。
AFRAME.registerComponent('cursor-listener', {
init: function () {
this.el.addEventListener('click', function (evt) {
console.log('I was clicked at: ', evt.detail.intersection.point);
});
}
});
</script>
</head>
<body>
<a-scene embedded arjs='trackingMethod: best; debugUIEnabled: false;' foo>
<a-assets>
<a-asset-item id="crate-obj" src="model.obj"></a-asset-item>
<a-asset-item id="crate-mtl" src="model.mtl"></a-asset-item>
<img id="texture" src="brick.jpg">
</a-assets>
<a-marker preset='hiro'>
<a-entity ><a-obj-model class="collidable" cursor-listener id="animated-marker" src="#crate-obj" position="0 -1.6 0" mtl="#crate-mtl" rotation="-90 0 0" scale="0.004 0.004 0.004" material="" obj-model=""></a-obj-model></a-entity>
//onclick doesn't work
<a-entity material=" src: url(box.png) " class="collidable" cursor-
listener position="0 -1 0"></a-entity> //onclick works here
</a-marker>
<a-camera-static/>
</a-scene>
</body>
</html>
答案 0 :(得分:2)
这是您想要的吗?
DataTable dt = objProfitLossDT.Select("AppBalance <= 0").CopyToDataTable();
请注意,如果源中没有行,则CopyToDataTable
会引发异常。所以你应该检查一下:
DataTable dt = objProfitLossDT.Clone(); // Clone is better than assigning null if you need the columns with an empty table
DataRow[] filteredRows = objProfitLossDT.Select("AppBalance <= 0");
if(filteredRows.Length > 0)
dt = objProfitLossDT.Select("AppBalance <= 0").CopyToDataTable();
顺便说一句,您知道您也可以使用LINQ,它比Select
更强大:
var filteredRows = objProfitLossDT.AsEnumerable()
.Where(row => row.Field<int>("AppBalance) <= 0)
.ToArray(); // if you want a DataRow[]