Ext JS - Learning Center

Tutorial talk:Custom Drag and Drop Part 3

From Learn About the Ext JavaScript Library

Jump to: navigation, search

i find an error in ie browser about this tutorial.

Will NOT work as shown in i.e.

Thanks for taking the time to do and share the tutorial.

However, if you run this tutorial in Explorer (yes!, I'm afraid some people do use it ;-) ) then will not work as the toSource() method used in the dd function is not supported.

Fixed

toSource does not work in IE. You need to use Ext.util.JSON.encode(data).

Thanks to http://curisu.wordpress.com/2008/09/29/javascript-tosource-in-ie67/

Just change the code as follows:

       // container 1
        var dd11 = Ext.get('dd1-item1');
        dd11.dd = new Ext.dd.DDProxy('dd1-item1', 'group', {
             dragData:{name:'Item 1.1',index:1},
             scope:this,
             fn:function(dd, data) {
                 //alert(data.toSource());
                 var myVar = Ext.util.JSON.encode(data);
                 alert(myVar);
             }
        });
         
        var dd12 = Ext.get('dd1-item2');
        dd12.dd = new Ext.dd.DDProxy('dd1-item2', 'group', {
             dragData:{name:'Item 1.2',index:2},
             scope:this,
             fn:function(dd, data) {
                 //alert(data.toSource());
                 var myVar = Ext.util.JSON.encode(data);
                 alert(myVar);
             }
  • This page was last modified on 20 April 2009, at 16:38.
  • This page has been accessed 2,147 times.