PDA

View Full Version : JS alert working fine but extjs alert not



sachin sachdeva
16 Dec 2010, 11:08 PM
hello sir i am sending here the code i really wnat to know that why this extjs alert is not working

<%
if(result != null) {
FileEx.deleteDir(filesDir);
if(msgList != null) {
String msg="";

int index=0;
int last=0;
for (int k = 0; k < msgList.size(); ++k) {
s =msgList.get(k);
if (!StringEx.isEmpty(s) && s.contains("already exists in folder"))
{ int i=0;
index = s.indexOf("name");
last= s.indexOf("already");
if(index!=-1&&last!=-1)
{

String a=s.substring(index,last);
int in = a.indexOf("'");
if(in!=-1){
filename1=a.substring(in+1,a.length()-2);
System.out.println(filename1);
}


}

}
%>
<script type="text/javascript">
alert('hi')----------------------------------------------WORKS ABSOLUTELY FINE
Ext.Msg.alert('hi')---------------------------------------does'nt work and control shifts immediately to next script block and displays that alert
</script>
<%
} }
%>

<script type="text/javascript">
Ext.Msg.show({
title:'Check-in Result',
msg: "File(s) Successfully Checked-in",
buttons: Ext.Msg.OK,
fn: function(but, text){
parent.mainTabPanel.remove(parent.multiassetwindow);
},
icon: Ext.MessageBox.INFO
});
</script>
colud u plz tell me how to overcome this

sachin sachdeva
17 Dec 2010, 1:37 AM
hello , in my jsp im iterating over a bunch of strings ,at the end of every iteration i want to print the string which i am getting from the for loop in an extjs alert message.i could do this using a normal js alert but not extjs alert.plz help........
following is the code

and i really want to know why extjs alert is not working properly actually it does not go with the loop and it displays for single time and normal alert displays as per the loop.

for (int k = 0; k < msgList.size(); ++k) {
s =msgList.get(k);
if (!StringEx.isEmpty(s) && s.contains("already exists in folder"))
{ int i=0;
index = s.indexOf("name");
last= s.indexOf("already");
if(index!=-1&&last!=-1)
{

String a=s.substring(index,last);
int in = a.indexOf("'");
if(in!=-1){
filename1=a.substring(in+1,a.length()-2);
System.out.println(filename1);
}


}

}
%>

<script type="text/javascript">

Ext.Msg.alert( '<%=filename1%>');-------------------works for single time only
// alert( '<%=filename1%>')-------------------------works fine as per loop
</script>

Animal
17 Dec 2010, 2:49 AM
Don't multi-post non-bugs in the bugs folder.

It works. As you know, Javascript does not stop.

You do not seriously expect the user to want to see "msgList.size()" seperate alerts!