Bouilleoliv / flexigrid

Automatically exported from code.google.com/p/flexigrid
0 stars 0 forks source link

it bug when parser Data from jSon String #118

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
just update addData function like this to fix it.

 $('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 != "undefined" && typeof row.cell[idx] != "undefined") {
                                    td.innerHTML = (row.cell[idx] != null) ? row.cell[idx] : ''; //null-check for Opera-browser
                                } else {
                                    td.innerHTML = row[p.colModel[idx].name];
                                }
                                $(td).attr('abbr', $(this).attr('abbr'));
                                $(tr).append(td);
                                td = null;
                            }
                        );
                        if ($('thead', this.gDiv).length < 1) {//handle if grid has no headers
                            for (idx = 0; idx < cell.length; idx++) {
                                var td = document.createElement('td');
                                // If the json elements aren't named (which is typical), use numeric order
                                if (typeof row.cell != "undefined" && typeof row.cell[idx] != "undefined") {
                                    td.innerHTML = (row.cell[idx] != null) ? row.cell[idx] : ''; //null-check for Opera-browser
                                } else {
                                    td.innerHTML = row[p.colModel[idx].name];
                                }
                                $(tr).append(td);
                                td = null;
                            }
                        }

Original issue reported on code.google.com by linh...@gmail.com on 19 Mar 2012 at 9:56