如何获取表示slickgrid中所选行的对象 [英] How to get the object which represents the selected row in a slickgrid

查看:91
本文介绍了如何获取表示slickgrid中所选行的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有slickgrid的网页,它在网格上呈现一个对象数组。当所选行发生变化时,我想做一些动态的东西(像设置这样的主要细节)。但是,为了能够这样做,我需要所选行的数据。我知道 grid.getCurrentCellNode()函数会给我当前节点的dom元素,但我要找的是一个javascript对象。例如,如果我使用下面的对象数组

I have a webpage with a slickgrid which renders an array of objects on a grid. I want to do some dynamic stuff (a master-detail like setup) when the selected row changes. However to be able to do this, I would need the data of the selected row. I know that the grid.getCurrentCellNode() function will give me the dom element of the current node, but what I am looking for is a javascript object. For instance, if I use an array of objects like the one below

data = [ 
        {id:1, name:'Khaja', dob:'26/07/1985'},
        {id:2, name:'Iqbal', dob:'26/07/1935'}
        ......
        ...
        ];

如果我选择的行是id等于2的行,我希望能够回溯对象 {id:2,名称:'Iqbal',dob:'26 / 07/1935'} 有没有办法可以获得这个对象?

and if my selected row is the row with id equal to 2, I want to be able to retrive the object {id:2, name:'Iqbal', dob:'26/07/1935'} Is there a way through which I can get this object?

推荐答案

您可以使用onSelectedRowsChanged事件和getSelectedRows方法。

You can use the onSelectedRowsChanged event and the getSelectedRows method.

这篇关于如何获取表示slickgrid中所选行的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆