tabalinas / jsgrid

Lightweight Grid jQuery Plugin
http://js-grid.com
MIT License
1.52k stars 352 forks source link

Js grid get cell value cellClick #1417

Open ashish435 opened 2 years ago

ashish435 commented 2 years ago

Hi Team I have js grid and three field Name, Age , MobileNo . So my question is i want to get a value of cell when we click on the cell Example : if i click on name then in alert msg Name value should be print , if i click on age then age value should be print. So basically its like cell click event

I have used rowClick but its not get solve my problem .i check in jsgrid tutorial and did not find any solution Please help me in this topic

djdance commented 1 year ago

I use to get it so

            rowClick: function(args) {
                let x=args.event.target.cellIndex
                let y=args.itemIndex
                let cell=Object.values(args.item)[x??0]
                console.log("rowClick cell["+x+","+y+"]=",cell)
            },
djdance commented 1 year ago

even so:

let field=this.option("fields")[x]
let cell=args.item[field.name]