gpt4 book ai didi

flexigrid 获取选定的行列值

转载 作者:行者123 更新时间:2023-12-04 23:26:39 26 4
gpt4 key购买 nike

我是 flexigrid 的新手。任何人都可以让我知道如何获取所选行的每一列值。?

如何获取每列名称(reportName 和 reportDescription)?因为我将//所有数据推送到如下所述的数组中。

我正在使用下面的代码来获取选定的行。但它返回空值。你能帮我吗?

//Column. <br/>


colModel: [
{ display: 'WidgetID', name: 'WidgetID', width: 50, sortable: true, align: 'left', hide: true },
{ display: 'Widget Name', name: 'WidgetName', width: 170, sortable: true, align: 'left' },
{ display: 'IsClientReport', name: 'IsClientReport', width: 50, sortable: false, align: 'left', hide: true },
{ display: 'ClientReportID', name: 'ClientReportID', width: 50, sortable: false, align: 'left', hide: true },
{ display: 'ReportType', name: 'ReportType', width: 280, sortable: true, align: 'left' }
],

$('#grid01').click(function(event){
$('.trSelected', this).each( function(){
console.log( ' rowId: ' + $(this).attr('id').substr(3) + ' IsClientReport: ' + $('td[abbr="IsClientReport"] >div', this).html() + ' sign: ' + $('td[abbr="WidgetID"] >div', this).html() + ' ReportType: ' + $('td[abbr="ReportType"] >div', this).html() );
});
});

谢谢,
庞库马尔潘迪安

最佳答案

不确定您是否已经弄清楚了,但我将把这个答案留在这里,以防其他处于相同情况的人像我一样偶然发现您的问题。

在列上设置 'sortable: false' 会从 Flexigrid 生成的 'td' 中删除 'abbr' 属性。这意味着您不能使用推荐的解决方案来获取所选行。

我自己修改了 flexigrid.js 文件来解决这个问题。

Flexigrid 以前仅在列具有“名称”和“可排序:真”时才添加“abbr”属性。我删除了“可排序:真”的条件。

反过来,这也意味着列将始终是可排序的。
为了防止这种情况,我添加了一个 'sortable' 属性,只有当列是 'sortable: true' 时才会设置该属性

在那之后,我不得不遍历并找到所有将“abbr”用作排序条件的情况,并将其替换为“可排序”的检查。

就是这样。

uploaded the file to mediafire如果您只是希望能够下载并使用这个来代替。在非特定地方有太多更改,我无法在此处显示我对代码的更改。如果需要,我可以提供差异或更多解释。请注意,'sortable: true' 仍然适用于我的修复。

关于flexigrid 获取选定的行列值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11868404/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com