如何通过网格分组获取所有ID?
我有一个 Kendo UI 网格,由对 api 的 Ajax 查询填充。 该网格具有用于示例 ID、状态(如果文档已生成或未生成)的列以及用于生成文档的按钮(如果尚未生成)。
我正在实现一个按钮来一次性为所有样本 ID 生成文档,并且需要获取剩余样本的 ID。
我根据状态对 ID 进行分组,如下所示:
dataSource.fetch(function(){
var view = dataSource.view();
console.log(view.length);
console.log(view[0]);
});
我想实现一个函数来获取所有 ID(状态为 'F' )并为它们生成文档。如何在函数中获取此视图数组?
我尝试了这个,但它说数据源未定义。
<button id='RegenerateButton' onclick=regenerateAll()>Regenerate All</button>
function regenerateAll(){
dataSource.fetch(function(){
var view = dataSource.view();
console.log(view.length);
console.log(view[0]);
});
}
我的数据源定义如下:
$(document).ready(function () {
var crudServiceBaseUrl = window.location.origin + "/api",
dataSource = new kendo.data.DataSource
({
type: "json",
serverPaging: true,
serverSorting: true,
serverFiltering: true,
allowUnsort: true,
pageSize: 10,
group:{field:"Status"},
transport: {
read: {
url: crudServiceBaseUrl + "/HL7Message/getListOfProcessedData/",
dataType: "json",
.....
I have a Kendo UI grid that is populated by Ajax query to an api.
The grid has column for sample IDs, status (if document is generated or not) and a button to generate the document (if not already).
I am implementing a button to generate documents for all sampleIds in one go and need to fetch the IDs of remaining ones.
And I group the IDs based on status like this:
dataSource.fetch(function(){
var view = dataSource.view();
console.log(view.length);
console.log(view[0]);
});
I want to implement a function that gets all the IDs (with status 'F' ) and generate documents for them. How do I get this view array in the function?
I tried this but it says datasource is undefined.
<button id='RegenerateButton' onclick=regenerateAll()>Regenerate All</button>
function regenerateAll(){
dataSource.fetch(function(){
var view = dataSource.view();
console.log(view.length);
console.log(view[0]);
});
}
My dataSource is defined like this:
$(document).ready(function () {
var crudServiceBaseUrl = window.location.origin + "/api",
dataSource = new kendo.data.DataSource
({
type: "json",
serverPaging: true,
serverSorting: true,
serverFiltering: true,
allowUnsort: true,
pageSize: 10,
group:{field:"Status"},
transport: {
read: {
url: crudServiceBaseUrl + "/HL7Message/getListOfProcessedData/",
dataType: "json",
.....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要做的第一个更改是获取数据源的数据 (文档)而不是视图。
在对数据进行分组方面,您需要执行以下操作:
:
以下是一个示例 由于数据源变量未定义,我需要查看更多代码。我能想到两种可能性:
The first change you will want to make is to get the data source's data (documentation) and not the view.
In terms of grouping the data you will need to do the following:
Here is an example:
In terms of the datasource variable being undefined, I will need to see a bit more code. There are two possibilities I can think of: