cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with UpdateGridEvent

Former Member
0 Kudos
53

Hi everyone,

I use two Grids that show list and details of Process Orders respectively.

I pass all necessary parameters from Front Page screen.The problem I face is I have to click the submit button twice to populate the ListGrid and to populate the DetailsGrid I have to click on an entry twice in ListGrid.

I'm using an xml query to populate the grids.After clicking the Submit button once, I can view the updated xml.But only when I click the button again I get values on the Grid.

I hope this ia a problem with the updateGridEvent that is used... Can some one help me out with this issue...

Thanks in advance,

Ajitha

Accepted Solutions (0)

Answers (2)

Answers (2)

sufw
Active Participant
0 Kudos

Hi Ajitha,

Alin is right, this is now 'normal' behaviour for IE due to a licensing issue with the technology used to user-interactive embed objects (e.g. Flash, Java applets) in HTML. You'll find that you won't have this issue if you don't use IE

Anyways, there are a few ways of getting around this issue. Basically, they all involve dynamically loading the Java applet after the page has loaded using JavaScript. There are a few ways of doing this (-> google for "click to activate and use this control"), but I've found the following the most elegant:

First wrap your Java Applet in a div and comment it out like this:

<div id="appletwrapper1">
  <!-- <applet ...>
    ...
  </applet>
  -->
</div>

Then, create a JavaScript function which gets triggered in the body's onload event to loop over the appletwrapper elements and remove the HTML comments around the applet tags. This will then cause IE to render them in the page and they'll already be activated.

Hope this helps,

Sascha

Former Member
0 Kudos

Thanks for your response Sascha and Alin...

Sascha, I'll try doing the wrapper that you have suggested.

BTW, this is the code I have used

<input type="button" value="Execute" onclick="passValues()" name="B1" style="font-family: Trebuchet MS; font-size: 10pt; font-weight: bold; float: left">

I use a drop down to select Plant, Ordertype and a java script written for calendar

function passValues()

{

var a = document.myForm.plant_selected.selectedIndex;

var plant = document.myForm.plant_selected.options[a].text;

var b = document.myForm.order_type.selectedIndex;

var ord_typ = document.myForm.order_type.options<b>.text;

var date_entered = document.myForm.date_selected.value;

var mm = date_entered.substring(0,2);

var dd = date_entered.substring(3,5);

var yyyy = date_entered.substring(6,10);

var date = yyyy mmdd;

window.open('http://<server name>/Lighthammer/Runner?IllumLoginName=<username>&IllumLoginPassword=<password>&Transaction=RMvsBatch/ProcordList'

'&Plant='plant'&OrderType='ord_typ'&DateFrom='date,null,"height=10,width=10,status=yes,toolbar=no,location=no");

document.Grid1.updateGrid(true);

}

Also can you please suggest me how I can call a transaction without opening a new window for it?

Thanks in advance...

Ajitha

sufw
Active Participant
0 Kudos

Hi Alin,

sorry to be pedantic, but I'd suggest changing some parts of your JavaScript code for cross-browser compatibility and to make sure it'll work in the future. For example:

- assign every HTML element (e.g. dropdown boxes) you want to deal with in code an id attribute which is unique to that page, e.g. <input type="button" id="btnExecute".../>

- reference elements using document.getElementById("btnExecute") rather than document.B1. Assigning pointer to the object (var button = ...) is fine.

- make sure you code in XHTML (i.e. every HTML document should also be a valid XML document)

xMII comes with a Java applet-based calendar control (iCalendar) which has some nice date format conversions and date calculations that you might find useful

If you'd like to execute the query behind an iChart or iGrid, use...

document.getElementById("iChartApplet").updateChart(true); (for iCharts)

document.getElementById("iGridApplet").updateGrid(true); (for iGrids)

In the above, 'true' causes the applet to re-execute the query, 'false' just re-draws the applet

If you'd like to execute a transaction but don't need visualisations (e.g. update a database with information entered into a HTML form), use an iCommand, which is basically an iGrid without the display part (size 1x1 pixel). iCommands are executed like this:

document.getElementById("iCommandApplet").executeCommand(); (no arguments)

Hope this helps,

Sascha

Former Member
0 Kudos

Hi Sascha,

I should probably put this under a different thread, but...

You mention to "make sure you in XHTML". I agree with this typically. However, have you ever tried to validate an irpt/htm page with the applet tag in it against a W3C compliant validator? It's kind of frustrating putting in the extra (albeit small) effort of XHTML only to have the validator stumble over the applet tag which is not supported by the XHTML standard. If I remember correctly, the applet tag may be valid, but the mayscript attribute is not as this is/was proprietary to Netscape. Even if you do mayscript="true" or mayscript="mayscript" the validator still yells at you. And without the mayscript attribute the applet events do not work. I'm curious if you've found any slick ways around this.

sufw
Active Participant
0 Kudos

Hi Ryan,

I was wondering whether that comment would come back to bite me

You're absolutely right though - our pages don't comply 100% but I try to be as close as possible. Regarding the 'mayscript' attribute, I normally use mayscript="true", which still works with xMII. So while this isn't XHTML compliant, it's at least XML....

On that note, the W3C validator also doesn't like in-page JavaScript all that much either and can complain about certain things, especially when you have HTML in JavaScript strings, and so on.

Sascha

Former Member
0 Kudos

I found that if you use CDATA in the javascript section of your code, the validator skims right over it - as it's suppose to.


<script type="text/javascript">
    <![CDATA[

    //js code in here...

    

]]>

sufw
Active Participant
0 Kudos

Hi Ryan,

thanks for the tip!

Sascha

Former Member
0 Kudos

One other really cool thing that I've been experimenting with is the use of JSON with xMII. JSON allows you to query xMII and process the result of that query as a Javascript object.

var MyDataset = JSON.load("yourURLtoXMII");

document.write("<table>");

for(i = 0;i< MyDataset.Rowsets.Rows.length;i++)

{

document.write("<tr>");

document.write("<td>" + MyDataset.Rowsets.Rows<i>.DateTime + "</td>");

document.write("<td>" + MyDataset.Rowsets.Rows<i>.LineSpeed + "</td>");

document.write("<td>" + MyDataset.Rowsets.Rows<i>.IncentivePay + "</td>");

document.write("<tr>");

}

document.write("</table>");

It opens up some interesting new possibilities.

- Rick

Former Member
0 Kudos

One other small note on this topic. You'll probably notice in the xMII Best Practices document (page 12) we hint at not modifying the applet definitions that are created by the Front Page / Dreamweaver wizards (ie, adding an id="" attribute and changing the mayscript to mayscript="true" attribute).

We included this in the Best Practices document because we've seen many times over where developers put a typo in the applet definition causing the applets to stop working.

It would be nice/cool if a future release of xMII changed the applet definitions created by the wizards to include an ID and the complete mayscript=true attributes IMO.

Former Member
0 Kudos

First is you should check the Java Console for any JavaScript errors or warnings.

The reason you have to click on the listGrid twice is because all Java applets rendered in Internet Explorer are locked until the user clicks on it. This was a Microsoft related patch that was released a while back for security reasons.

So basically you click it once to activate, then a second time to select whatever line item you would like.

As for the initial ListGrid requiring you to click the "Submit" button twice, you would have to post up some of your code that gets called when the Submit button is pressed and how you call that function.

Hope this helps!

-


Note: If this was helpful please assign points.