3.2.0

Dynamic load grid on iframe.

Hi everybody,
I am try to load the grid into a iframe with dynamic data but I don't have success.

I explore the tutorial code and see a usefull peace of code. I copy this code and adapt to my need.

var grid ="";//= 'var myColumns = ["Campo 0", "Campo 1", "Campo 2", "Campo 3"];';
                        grid += 'var obj = new Active.Controls.Grid;';
                        grid += 'obj.setId("grid1");';
                        grid += 'obj.setModel("row", new Active.Rows.Page);';
                        grid += 'obj.setRowProperty("pageSize", 10);';
                        grid += 'function getPageNumber() { return obj.getRowProperty("pageNumber") + 1; }';
                        grid += 'function getPageCount() { return obj.getRowProperty("pageCount"); }';
                        grid += 'function goToPage(delta) {';
                        grid += 'var count = obj.getRowProperty("pageCount");';
                        grid += 'var number = obj.getRowProperty("pageNumber");';
                        grid += 'number += delta;';
                        grid += 'if (number < 0) {number = 0}';
                        grid += 'if (number > count-1) {number = count-1}';
                        grid += 'obj.setRowProperty("pageNumber", number);';
                        grid += 'obj.refresh();';
                        grid += '}';
                        
                        grid += 'obj.setRowProperty("count", 50);';
                        grid += 'obj.setColumnProperty("count", 4);';
                        grid += 'obj.setDataProperty("text", function(i, j){return "Dado[" + i + "," + j + "]"});';
                        grid += 'obj.setColumnProperty("text", function(i){return myColumns[i]});';
                                                    
                        grid += 'document.write(obj);';                       
                        
                        var source = "grid1";
                        var style = "width:100%;height:350px;border:1px solid #CBC7B8;";
                        
                        try {
                            var name = source + "-frame";
                            var f = "<iframe name='" + name + "' id='" + name + "' style='" + style +"' frameborder=\"0\"></iframe>";
                            document.write(f);
                    
                            var doc = frames[name].document;
                            doc.open();
                            doc.write("<html><head>");
                            doc.write("</head><body>");
                            doc.write("</body></html>");
                            doc.close()
                    
                            var wl = window.onload;
                    
                            window.onload = function(){
                    
                                if (typeof wl == "function" ) {wl()}
                    
                                var doc = frames[name].document;
                                doc.open();
                                doc.write("<html><head>");
                                doc.write("<style> body, html {margin:0px; padding: 0px; overflow: hidden; font: menu} </style>");
                                doc.write("<link href=\"js/grid.css\" rel=\"stylesheet\" type=\"text/css\" ></link>");                                
                                doc.write("<s" + "cript src=\"js/grid.js\"></s" + "cript>");
                                doc.write("<s" + "cript src=\"js/paging1.js\"></s" + "cript>");
                                doc.write("</head><body>");
                                doc.write("<s" + "cript>" + grid + "</s" + "cript>");
                    
                                window.setTimeout(function(){
                                        doc.write("</body></html>");
                                        doc.close()
                                }, 1000);
                    
                            }
                        } catch (e) {
                            alert("Erro " + e.message);
                        }


In this example I only want to simullate a data load. This code works fine offline, but when I try to load this online the explorer freeze...

Can somebody help me?
Vinícius Pitta Lima de Araújo
September 16,
Note:
The right is:
var grid = 'var myColumns = ["Campo 0", "Campo 1", "Campo 2", "Campo 3"];';

Instead of:
var grid ="";//= 'var myColumns = ["Campo 0", "Campo 1", "Campo 2", "Campo 3"];';
Vinícius Pitta Lima de Araújo
September 16,

This topic is archived.

See also:


Back to support forum