Skip to content

Commit

Permalink
Merge pull request paulopmx#2 from romanbsd/master
Browse files Browse the repository at this point in the history
Three small changes
  • Loading branch information
paulopmx committed Aug 7, 2011
2 parents a902b67 + f7a2a1d commit 2cc0b51
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions js/flexigrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
rp: 15, //results per page
rpOptions: [10, 15, 20, 30, 50], //allowed per-page values
title: false,
idProperty: 'id',
pagestat: 'Displaying {from} to {to} of {total} items',
pagetext: 'Page',
outof: 'of',
Expand Down Expand Up @@ -345,19 +346,24 @@
if (i % 2 && p.striped) {
tr.className = 'erow';
}
if (row.id) {
tr.id = 'row' + row.id;
if (row[p.idProperty]) {
tr.id = 'row' + row[p.idProperty];
}
$('thead tr:first th', g.hDiv).each( //add cell
function () {
var td = document.createElement('td');
var idx = $(this).attr('axis').substr(3);
td.align = this.align;
// If the json elements aren't named (which is typical), use numeric order
if (typeof row.cell[idx] != "undefined") {
td.innerHTML = (row.cell[idx] != null) ? row.cell[idx] : '';//null-check for Opera-browser
// If each row is the object itself (no 'cell' key)
if (typeof row.cell == 'undefined') {
td.innerHTML = row[p.colModel[idx].name];
} else {
td.innerHTML = row.cell[p.colModel[idx].name];
// If the json elements aren't named (which is typical), use numeric order
if (typeof row.cell[idx] != "undefined") {
td.innerHTML = (row.cell[idx] != null) ? row.cell[idx] : '';//null-check for Opera-browser
} else {
td.innerHTML = row.cell[p.colModel[idx].name];
}
}
$(td).attr('abbr', $(this).attr('abbr'));
$(tr).append(td);
Expand Down Expand Up @@ -760,9 +766,12 @@
});
btnDiv.onpress = btn.onpress;
btnDiv.name = btn.name;
if (btn.id) {
btnDiv.id = btn.id;
}
if (btn.onpress) {
$(btnDiv).click(function () {
this.onpress(this.name, g.gDiv);
this.onpress(this.id || this.name, g.gDiv);
});
}
$(tDiv2).append(btnDiv);
Expand Down Expand Up @@ -1242,4 +1251,4 @@
});
}
}; //end noSelect
})(jQuery);
})(jQuery);

0 comments on commit 2cc0b51

Please sign in to comment.