簡體   English   中英

為什么YUI 2 DataTables不能在IE中工作,但可以在FireFox中工作?

[英]Why won't YUI 2 DataTables work in IE but DO work in FireFox?

因此,我正在使用YUI 2數據表窗口小部件和tabview組件來顯示多個查詢的結果,這些查詢在具有漂亮,樣式和可排序表的單獨選項卡中同時執行。 在FireFox中效果很好。 在IE中,它僅以簡單的HTML表標記顯示數據,該標記是由PHP在服務器端生成的,實際上是用作datatable小部件的DataSource。 我所有的HTML都是在服務器端生成的。 這是我的腳本:

<script type="text/javascript">
  YAHOO.util.Event.onContentReady("ready14", function() {
 //Sets globals

 var dataSource= YAHOO.util.DataSource;
 var getIt = YAHOO.util.Dom.get;
 var dataType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
 var table =  YAHOO.widget.DataTable;
 var scroll = YAHOO.widget.ScrollingDataTable;
 var numbers= YAHOO.widget.DataTable.formatNumber;
 var strings = YAHOO.widget.DataTable.formatString;
 var dates = YAHOO.widget.DataTable.formatDate;

 var niceTables = function() {


            var myTabView = new YAHOO.widget.TabView("reportTables");
        var myColumnDefs =[
            {key:"Tactic",formatter:strings,sortable:true},
            {key:"Opt-In Count",formatter:numbers,sortable:true,        sortOptions:     defaultDir: table.CLASS_DESC }},
        ];
         var myColumnDefs2 =[
            {key:"Tactic",formatter:strings,sortable:true},
            {key:"Opt-In Count",formatter:numbers,sortable:true, sortOptions: { defaultDir: table.CLASS_DESC }},
        ];
        var myColumnDefs3 =[
            {key:"Lead Meta Data ID" },{key:"First Name",formatter:strings,sortable:true},{key:"Last Name",formatter:strings,sortable:true},{key:"Address"}, {key:"City",formatter:strings,sortable:true},{key:"State",formatter:strings,sortable:true},{key:"Zip",formatter:strings,sortable:true}, {key:"Email"},{key:"Phone"}, {key:"Gender",formatter:strings,sortable:true},
            {key:"DOB",formatter:dates,sortable:true},{key:"Lead Type",formatter:strings,sortable:true}, {key:"Lead Source"},{key:"LOB",formatter:strings,sortable:true},{key:"Client",formatter:strings,sortable:true},{key:"Rep Nbr",formatter:strings,sortable:true, sortOptions: { defaultDir: YAHOO.widget.DataTable.CLASS_DESC }},{key:"Duplicate",formatter:strings,sortable:true},{key:"Comments"}, {key:"Social Media Source",formatter:strings,sortable:true},{key:"Lead Ready",formatter:dates,sortable:true,},{key:"Lead Sent",formatter:dates,sortable:true, sortOptions: { defaultDir: YAHOO.widget.DataTable.CLASS_DESC }},{key:"Tactic Name",formatter:strings,sortable:true},{key:"Tactic Line Of Business ",formatter:strings,sortable:true},
        ];

                    var myColumnDefs4 =[
            {key:"Prize Type",formatter:strings,sortable:true },{key:"First Name",formatter:strings,sortable:true},{key:"Last Name",formatter:strings,sortable:true},{key:"Address"},{key:"City", sortable:true}, {key:"State",formatter:strings,sortable:true},{key:"Zip",formatter:strings,sortable:true},{key:"Email"}, {key:"Phone"}, {key:"Play Date",formatter:dates,sortable:true, sortOptions: { defaultDir:table.CLASS_DESC }},
           ];
        var myColumnDefs5 =[
            {key:"Prize Type",formatter:strings,sortable:true },
            {key:"Prize Type Count",formatter:numbers,sortable:true, sortOptions: { defaultDir: table.CLASS_DESC }},
        ];
        var myColumnDefs6 =[
            {key:"Lead Source",formatter:strings,sortable:true},
            {key:"Dupe Count",formatter:numbers,sortable:true, sortOptions: { defaultDir:table.CLASS_DESC }},
        ];
        var myColumnDefs7 =[
            {key:"Guitar Type",formatter:strings,sortable:true },
            {key:"Count",formatter:numbers,sortable:true, sortOptions: { defaultDir: table.CLASS_DESC }},
        ];
        var myColumnDefs8 =[
            {key:"Tactic",formatter:strings,sortable:true },
            {key:"Opt-In Count",formatter:numbers,sortable:true, sortOptions: { defaultDir: table.CLASS_DESC }},
        ];
        var myColumnDefs9 =[
            {key:"Tactic",formatter:strings,sortable:true },
            {key:"Opt-In Count",formatter:numbers,sortable:true, sortOptions: { defaultDir: table.CLASS_DESC }},
        ];
                    var myColumnDefs10 =[
            {key:"Concert ID" },{key:"Artist" },{key:"Concert City" },{key:"Concert State" },{key:"Concert Date" },{key:"Entry Deadline" },{key:"Lead Meta Data ID" }, {key:"First Name"},
             {key:"Last Name"}, {key:"Address"},{key:"City"},{key:"State"},{key:"Zip"},{key:"Email"},{key:"Phone"},{key:"Lead Type"},{key:"Lead Source"},   {key:"LOB"},{key:"Client"},{key:"Rep Nbr"}, {key:"Duplicate"},,
        ];

        //get the YUI DataSource for each table
        var myDataSource =  new dataSource(getIt("optins"));
        myDataSource.responseType = dataType;
        myDataSource.responseSchema = {
            fields: ["Tactic","Opt-In Count"]
        };
        var myDataSource2 =  new dataSource(getIt("optTotal"));
        myDataSource2.responseType = dataType;
        myDataSource2.responseSchema = {
            fields: ["Tactic","Opt-In Count"]
        };
        var myDataSource3 =  new dataSource(getIt("optInReport"));
        myDataSource3.responseType = dataType;
        myDataSource3.responseSchema = {
            fields: ["Lead Meta Data ID","First Name","Last Name","Address","City","State","Zip","Email","Phone",
                    "Gender","DOB","Lead Type","Lead Source","LOB","Client","Rep Nbr","Duplicate","Comments","Social Media Source","Lead Ready","Lead Sent","Tactic Name","Tactic Line Of Business",]
        };
        var myDataSource4 =  new dataSource(getIt("spinWinners"));
        myDataSource4.responseType = dataType;
        myDataSource4.responseSchema = {
            fields: ["Prize Type","Band","First Name","Last Name","Address","City","State","Zip","Email","Phone","Play Date",]
        };
         var  myDataSource5 =  new dataSource(getIt("prizes"));
         myDataSource5.responseType = dataType;
         myDataSource5.responseSchema = {
            fields: ["Prize Type","Prize Type Count"]
        };
         var  myDataSource6 =  new dataSource(getIt("dupeCount"));
        myDataSource6.responseType = dataType;
        myDataSource6.responseSchema = {
            fields: ["Lead Source","Dupe Count"]
        };
         var myDataSource7 =  new dataSource(getIt("guitarType"));
        myDataSource7.responseType = dataType;
        myDataSource7.responseSchema = {
            fields: ["Guitar Type","Count"]
        };
         var myDataSource8 =  new dataSource(getIt("guitarTactic"));
        myDataSource8.responseType = dataType;
        myDataSource8.responseSchema = {
            fields: ["Tactic","Opt-In Count"]
        };
        var myDataSource9 =  new dataSource(getIt("OptInsSent"));
        myDataSource9.responseType = dataType;
        myDataSource9.responseSchema = {
            fields: ["Tactic","Opt-In Count"]
        };
          var myDataSource10 =  new dataSource(getIt("ticketEntries"));
       myDataSource10.responseType = dataType;
       myDataSource10.responseSchema = {
           fields: ["Concert ID","Artist","Concert City","Concert State","Concert Date","Entry Deadline","Lead Meta Data ID","First Name","Last Name","Address","City","State","Zip","Email","Phone",
                 "Lead Type","Lead Source","LOB","Client","Rep Nbr","Duplicate",]
        };


                        new table("table1", myColumnDefs, myDataSource);            
                        new table("table3", myColumnDefs2, myDataSource2);          
                        new scroll("table4", myColumnDefs3, myDataSource3,{width:"118em", height:"53em"});          
                        new table("table6", myColumnDefs4, myDataSource4);          
                        new table("table7", myColumnDefs5,  myDataSource5);         
                        new table("table8", myColumnDefs6, myDataSource6);          
                        new table("table10", myColumnDefs7, myDataSource7);
                        new table("table11", myColumnDefs8, myDataSource8);         
                        new table("table12", myColumnDefs9, myDataSource9);                       
                        new scroll("table13", myColumnDefs10, myDataSource10,{width:"118em", height:"53em"});
            }();











        return {

        };

});

您的對象/數組中有尾隨逗號。 IE在結尾的逗號中令人窒息。

var breaksIE = ['trailing', 'comma', '=>', ]; // boom

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM