Hi,
I'm implementing a function (copy grid data to clipboard) that requires all grid values in a javascript. First, I looked examples and cannot find one. Second i looked document and cannot find instructioin. I looked into infragistic installed directory, and find some javascripts, use trial and error to find out each function. Is there better way? Where is complete document for using objects?
But I'm still having problems. I'm able to get cell object, but I don't know how to get value. Here is how I get all cells:
function copyButtonClicked() {
var elm = document.getElementById('clipboardFormId:gridViewId'); // grid component id if(elm!=null) { var mygrid=ig.grid.getGrid(elm); if(!ig.isNull(mygrid)) { var gridbody = mygrid.getBody(); if(!ig.isNull(gridbody)) { for(i=0; i<mygrid.getRowCount(); i++) { for(j=0; j<mygrid.getColCount(); j++) { var cell=gridbody.getCell(i, j);
.....
}
I'm stucked here, I don't know what to do with object cell. How to get the value? I somehow get the innerHTML:
cell.elm.innerHTML
But it is not the value and somehow I cannot get column title.
I'm trying to find document for row, col and cell object function. I cannot find any. The online examples are not sufficient.
Please Help
Thanks
Yan
Hi ,
Here in this script code, how can we get the particular cell which i entered the value in that cell, i need to set the focus for that cell. Because i am loosing the focus of the cell, i want to put the cursor in the particular cell.
Please send me the code. very very urgent.
Thanks,
A.Viswanath Yadav
It worked.
Thanks.
Hello yzbythesea, Here's one more way to get all the grid Values in javascript.
function copyGridValues() { var rows = ig.grid.instances.myForm_grid.elm.childNodes[0].childNodes[1].rows; var i=0; while(i<rows.length) { var rowsCells = rows[i].childNodes; alert(rowsCells[0].childNodes[0].data + " " + rowsCells[1].childNodes[0].data + " " + rowsCells[2].childNodes[0].data + " " + rowsCells[3].childNodes[0].data); i++; }}
Thank you!Swetha
Hello, YanYou should create a new IgGridCell and after that you can use method get_value() or get_text() : for(j=0; j<mygrid.getColCount(); j++) { var cell=gridbody.getCell(i, j); var newCell = new IgGridCell(cell.elm); var text = newCell.get_text(); var value = newCell.get_value(); }
The js file "igf_grid.js" contains js functions conected with the grid .