1. #1
    Sencha User
    Join Date
    Oct 2013
    Posts
    9
    Vote Rating
    0
    ank5 is on a distinguished road

      0  

    Default Ext JS 4 - alert not displaying

    Ext JS 4 - alert not displaying


    I have an Ext JS function in which I was displaying a javascript alert and it worked perfectly fine.

    Code:
    if(matchStatus == false) {    
                alert('Please refine your selection');
                return false;
            }
    Now I want to display an Ext JS alert instead of Javascript alert, so I changed the above code to

    Code:
    if(matchStatus == false) {
                Ext.Msg.alert("Alert", "Please refine your selection");
                return false;
            }
    Now this code does not work. In my UI, I get an blank alert window (please refer to the attached screenshot).

    Can someone please help me resolve this problem. Thank you.
    Attached Images

  2. #2
    Sencha User
    Join Date
    Jul 2013
    Location
    Mysore, Karnataka, India
    Posts
    83
    Vote Rating
    5
    sanjayon19 is on a distinguished road

      0  

    Default Did you miss to link ExtJS library?

    Did you miss to link ExtJS library?


    Hi,

    I added the same line in my code and I'm able to see the ExtJS alert message.
    I think you might have missed to link the ExtJS library to your application/project.

    Based on the location of the library files, you can link your ExtJS lib files to your application like below. Add the lines to your index.jsp/index.html whatever you have and make sure you have the ExtJS library files are at proper location.

    <link rel="stylesheet" type="text/css" href="../../lib/extjs/resources/css/ext-all.css" />
    <script src="../../lib/extjs/ext-all.js" type="text/javascript"></script>
    Last edited by sanjayon19; 5 Nov 2013 at 12:55 AM. Reason: More info added

  3. #3
    Sencha User
    Join Date
    Oct 2013
    Posts
    9
    Vote Rating
    0
    ank5 is on a distinguished road

      0  

    Default


    Thanks for your reply.

    It is able to find the Ext JS libraries. All the logic gets evaluated and based on that Javascript alert is displayed, however Ext JS alert is not displayed properly.

    Below is my complete function which is called from the UI

    Code:
    (function() {
        m2m.getLinkStatus = function(folderObjID, docParentFolderIDs) {
            var matchStatus = true;
            folderObjID = folderObjID+"";
            docParentFolderIDs = docParentFolderIDs+"";
                    
           var folderObjIDArray = '';
            var docParentFolderIDsArray = '';
    
    
            if(folderObjID != '') {
                folderObjIDArray = folderObjID.split(',');
            }
            if(docParentFolderIDs != '') {
                docParentFolderIDsArray = docParentFolderIDs.split(',');
                //        alert('array size docParentFolderIDsArray '+docParentFolderIDsArray.length);
            }
    
    
    
    
            for(var i = 0; i < folderObjIDArray.length; i++){
                for(var j = 0; j < docParentFolderIDsArray.length; j++){
                    if(folderObjIDArray[i].indexOf(docParentFolderIDsArray[j]) > -1) {
                        matchStatus = false;
                    }
                }
            }
            if(matchStatus == false) {
              //  Ext.Msg.alert("Alert", "Please refine your selection");
             //   alert('Please refine your selection');
               Ext.onready(function(){
                    Ext.MessageBox.alert("Alert", "Please refine your selection");
               });    
                return false;
            }
    
    
            return matchStatus;
        };
    })();

  4. #4
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Perhaps your code is running too early? It isn't clear exactly when it runs but you could try moving it into an Ext.onReady.

  5. #5
    Sencha User
    Join Date
    Oct 2013
    Posts
    9
    Vote Rating
    0
    ank5 is on a distinguished road

      0  

    Default


    Tried putting the alert in onReady but it didn't help either

    Code:
    Ext.namespace('m2n');
    
    (function() {
        m2n.getLinkStatus = function(folderObjID, docParentFolderIDs) {
            var matchStatus = true;
            folderObjID = folderObjID+"";
            docParentFolderIDs = docParentFolderIDs+"";
            
            var folderObjIDArray = '';
            var docParentFolderIDsArray = '';
    
    
            if(folderObjID != '') {
                folderObjIDArray = folderObjID.split(',');
            }
            if(docParentFolderIDs != '') {
                docParentFolderIDsArray = docParentFolderIDs.split(',');
            }
    
    
    
    
            for(var i = 0; i < folderObjIDArray.length; i++){
                for(var j = 0; j < docParentFolderIDsArray.length; j++){
                    if(folderObjIDArray[i].indexOf(docParentFolderIDsArray[j]) > -1) {
                        matchStatus = false;
                    }
                }
            }
            if(matchStatus == false) {
               Ext.onReady(function(){
    				Ext.MessageBox.alert("Alert1", "Please refine your selection1");
    		   });		    
               return false;
            }
            return matchStatus;
        };
    })();

  6. #6
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Definitely no JavaScript errors? Definitely the right version of the ExtJS CSS to go with the JS?

    Do you have any other CSS on the page that might be interfering?

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar