Closed GoogleCodeExporter closed 8 years ago
This could be done using native javascript (or jQuery).
Original comment by eric.caron
on 22 Dec 2010 at 3:41
[deleted comment]
[deleted comment]
[deleted comment]
hello, I have solution..
for grid with colModel like this:
colModel : [
{name: 'name', display: 'NAME' },
{name: 'status', display: 'STATUS' },
{name: 'sign', display: 'SIGN' }
]
we can obtain cell data by using hDiv, like this:
$('#grid02').click(function(event){
var grid = this;
var flex = $(grid).closest('.flexigrid');
var abbr = [];
$('.hDiv th', flex).each( function(index){
abbr[index] = $(this).attr('abbr');
});
$('.res').html('');//div.res - area for display result
$('.trSelected', grid).each( function(){
$('.res').html(
$('.res').html() +
'<br />rowId: ' + $(this).attr('id').substr(3) +
'<br />name: ' + $('td:nth-child('+ (1+$.inArray('name',abbr)) +')>div', this).html() +
'<br />sign: ' + $('td:nth-child('+ (1+$.inArray('sign',abbr)) +')>div', this).html() +
'<br />status: ' + $('td:nth-child('+ (1+$.inArray('status',abbr)) +')>div', this).html()
);
});
});
But. If we add 2 lines to flexigrid code, we get data by attribute like this:
$('#grid02').click(function(event){
$('.res').html('');//div.res - area for display result
$('.trSelected', this).each( function(){
$('.res').html(
$('.res').html() +
'<br />rowId: ' + $(this).attr('id').substr(3) +
'<br />name: ' + $('td[abbr="name"] >div', this).html() +
'<br />sign: ' + $('td[abbr="sign"] >div', this).html() +
'<br />status: ' + $('td[abbr="status"] >div', this).html()
);
});
});
patch: in flexigrid addData
codeblock if (p.dataType=='json')
$('thead tr:first th',g.hDiv).each
(
function ()
{
var td = document.createElement('td');
var idx = $(this).attr('axis').substr(3);
td.align = this.align;
td.innerHTML = row.cell[idx];
/*!*/ $(td).attr('abbr', $(this).attr('abbr'));
$(tr).append(td);
td = null;
}
);
codeblock if (p.dataType=='xml')
$('thead tr:first th',g.hDiv).each
(
function ()
{
var td = document.createElement('td');
var idx = $(this).attr('axis').substr(3);
td.align = this.align;
td.innerHTML = $("cell:eq("+ idx +")",robj).text();
/*!*/ $(td).attr('abbr', $(this).attr('abbr'));
$(tr).append(td);
td = null;
}
);
Original comment by ymkin....@gmail.com
on 7 Mar 2011 at 10:48
Original issue reported on code.google.com by
mr.mu...@gmail.com
on 11 Sep 2008 at 1:02