简体   繁体   English

如何从Vaadin Grid中使用聚合物获取选定的行数据?

[英]How to get selected row data from Vaadin Grid with polymer?

I am trying to get the selected row data form vaadin grid using polymer. 我试图使用聚合物从vaadin网格中获取选定的行数据。 But I am not able to get. 但是我无法得到。

Here is the my code: 这是我的代码:

this.mileageGrid = this.$$("#mileageSectionGrid");
         this.mileageGrid.addEventListener('selected-items-changed', function() {
                var selected = this.mileageGrid.selection.selected();
                this.selectedRowData = this.mileageGrid.getSelectedRow();
                this.selectedRowData = this.mileageGrid.selection.getSelectedRow();
                if (selected.length == 1) {
                    detailsOpenIndex = selected[0];
                    this.callback(detailsOpenIndex);
                    //this.fire("change-mileage", this.mileage);
                }
        }.bind(this));

I didn't get any idea after searching from google and vaadin grid document also. 从Google和vaadin网格文档中搜索后,我也一无所知。

Can anybody tell me, how to get selected row data? 有人可以告诉我如何获取选定的行数据吗?

These two lines seem to be incorrect, and look more like something from the Vaadin Java framework API: 这两行似乎不正确,看起来更像是Vaadin Java框架API中的内容:

this.selectedRowData = this.mileageGrid.getSelectedRow();
this.selectedRowData = this.mileageGrid.selection.getSelectedRow();

I think those are probably causing errors in the browser and any following JavaScript is not working. 我认为这些可能会导致浏览器出现错误,并且以下任何JavaScript无法正常工作。 Check for any errors in your browser's console. 在浏览器的控制台中检查是否有任何错误。

Otherwise I can't spot any issues in your code (I'm just not sure if you've declared detailsOpenIndex and this.callback outside the visible code). 否则,我无法在您的代码中发现任何问题(我不确定您是否已在可见代码之外声明了detailsOpenIndexthis.callback )。

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

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