Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    window.open() is not working properly in callback methods

    Hi,
    I am using javascript method window.open() to downloan a .xls file from the server.. Its working properly in normal cases.

    code:
    Code:
    window.open(myserverurlandfilename);
    But if i use the same code inside a fetchcallback method of a listgrid it is opening the file to save.( This problem occures only in IE not in Mozilla )

    To explore the problem i have used a databasound update sample of the smartclient demo.
    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true,
        dataSource: worldDS,
        // display a subset of fields from the datasource
        fields:[
            {name:"countryCode"},
            {name:"countryName"},
            {name:"capital"},
            {name:"continent"}
        ],
        sortFieldNum: 0, // sort by countryCode
        dataPageSize: 50,
        autoFetchData: true,
        selectionType: "single"
    })
    
    
    isc.IButton.create({
        left:0, top:240, width:150,
        title:"Continent > Europe",
        click: function () {
            if (!countryList.getSelectedRecord()) return; // nothing selected
            var updatedRecord = isc.addProperties(
                countryList.getSelectedRecord(),
                {continent:"Europe"}
            );        
            countryList.updateData(updatedRecord);
        }
    })
    
    
    isc.IButton.create({
        left:170, top:240, width:150,
        title:"Continent > Asia",
        click: function () {
            window.open('http://www.simon.incutio.com/slides/2006/etech/javascript/js-reintroduction-notes.pdf');
            if (!countryList.getSelectedRecord()) return; // nothing selected
            var updatedRecord = isc.addProperties(
                countryList.getSelectedRecord(),
                {continent:"Asia"}
            );        
             countryList.updateData(updatedRecord,function() {alert('saved successfully');
            window.open('http://www.simon.incutio.com/slides/2006/etech/javascript/js-reintroduction-notes.pdf');
    });
        }
    })

    In the above sample i have just tried to open the pdf file to save using
    window.open() .
    In the first call its working but the code inside the callback is not at all working..

    Can you help me to resolve this..

    Thanks

    #2
    Hi Rajadurai,

    This isn't a SmartClient problem, but to give you a hint anyway, it may have to do with the HTTP "Content-Disposition" header - try some web searches.

    Comment

    Working...
    X