E
egrigg9000
Hello,
I am attempting to follow the advice in this posting:
http://groups-beta.google.com/group...3d91c07?q=xdExtension&rnum=5#5966ae9613d91c07
In the repeating group below, there will be one line for each item we
are tracking. I am working on the template. Only some cases will
require comments to be filled out, so it's not worth taking up the
pixels for a text field for every line. The "Enter Comments" button
I have pulling up a javascript dialog which returns a value to the
Comments node for the line it was accessed. Which is cool and works.
I would only like the "Enter Comments" button to show up if the
line in the repeating group is selected.
Right now the behavior is, the "Enter Comments" button does not
show up even though the line is selected.
Can anyone help? I have pasted the code below.
Thanks in advance,
- Elizabeth Grigg
egrigg9000 at yahoo dot com
The data structure is:
<root>
<items>
<StandardItem> //this is bound to the repeating table
<Item Number/>
<Item Title />
<Compliant Percentage />
<Comments /> //this is bound to the button below
close tags etc.
The table layout is:
REPEATING TABLE
ITEM NUMBER | ITEM TITLE | COMPLIANT PERCENTAGE | COMMENTS
___________ __________ ____________________ _________
Textbox | Textbox | Dropdown List | "Enter Comments"
button
The conditional formatting for the Enter Comments button is:
"not(xdExtension:get-fDisplayComments())"
The button is default set to HIDE.
The code:
//Note there is logic in here to turn OFF the button in the row
selected previously. It occurs before the turn ON button logic to
handle the case where the user is clicking on the same location.
//I have traced this code and determined that the helper function is
called, including the ForceUpdate line, but to no visible effect on the
button.
//EG Place for Globals
var fDisplayComments = false;
var sPrevNodeName = "";
//EG End Globals
//EG Helper Functions
//EG HF1 This HF changes the visibility of the comments button
function SetCommentsVisibility(fCommentsVisible)
{
fDisplayComments = fCommentsVisible;
XDocument.View.ForceUpdate();
}
//EG End Helper Functions
//... not including empty functions for other events
function XDocument::OnContextChange(eventObj)
{
if (eventObj.Type == "ContextNode")
{
//don't do anything if the contextchange is away from the object,
such as user clicking outside the repeating group
if (sPrevNodeName != "my:StandardItems")
{
// Selection or context in the form has changed. Write your
code here to respond to the changes.
var objNode;
//Handler for previous node to turn off the button
if (sPrevNodeName != "")
{
objNode = XDocument.DOM.selectSingleNode("//" +
sPrevNodeName);
SetCommentsVisibility(false);
}//end if ""
//Handler for current node to turn on the button
objNode =
eventObj.Context.selectSingleNode("parent::*").nodeName;
SetCommentsVisibility(true);
//Establishment of current node as previous for next time
sPrevNodeName =
eventObj.Context.selectSingleNode("parent::*").nodeName;
}//end if StandardItems
return;
}//end if ContextNode
}
Thanks everyone!
Best,
- EG
P.S. Not sure what protocol is with code snippets, you might want to
paste into Notepad in order to see minus the carriage returns.
I am attempting to follow the advice in this posting:
http://groups-beta.google.com/group...3d91c07?q=xdExtension&rnum=5#5966ae9613d91c07
In the repeating group below, there will be one line for each item we
are tracking. I am working on the template. Only some cases will
require comments to be filled out, so it's not worth taking up the
pixels for a text field for every line. The "Enter Comments" button
I have pulling up a javascript dialog which returns a value to the
Comments node for the line it was accessed. Which is cool and works.
I would only like the "Enter Comments" button to show up if the
line in the repeating group is selected.
Right now the behavior is, the "Enter Comments" button does not
show up even though the line is selected.
Can anyone help? I have pasted the code below.
Thanks in advance,
- Elizabeth Grigg
egrigg9000 at yahoo dot com
The data structure is:
<root>
<items>
<StandardItem> //this is bound to the repeating table
<Item Number/>
<Item Title />
<Compliant Percentage />
<Comments /> //this is bound to the button below
close tags etc.
The table layout is:
REPEATING TABLE
ITEM NUMBER | ITEM TITLE | COMPLIANT PERCENTAGE | COMMENTS
___________ __________ ____________________ _________
Textbox | Textbox | Dropdown List | "Enter Comments"
button
The conditional formatting for the Enter Comments button is:
"not(xdExtension:get-fDisplayComments())"
The button is default set to HIDE.
The code:
//Note there is logic in here to turn OFF the button in the row
selected previously. It occurs before the turn ON button logic to
handle the case where the user is clicking on the same location.
//I have traced this code and determined that the helper function is
called, including the ForceUpdate line, but to no visible effect on the
button.
//EG Place for Globals
var fDisplayComments = false;
var sPrevNodeName = "";
//EG End Globals
//EG Helper Functions
//EG HF1 This HF changes the visibility of the comments button
function SetCommentsVisibility(fCommentsVisible)
{
fDisplayComments = fCommentsVisible;
XDocument.View.ForceUpdate();
}
//EG End Helper Functions
//... not including empty functions for other events
function XDocument::OnContextChange(eventObj)
{
if (eventObj.Type == "ContextNode")
{
//don't do anything if the contextchange is away from the object,
such as user clicking outside the repeating group
if (sPrevNodeName != "my:StandardItems")
{
// Selection or context in the form has changed. Write your
code here to respond to the changes.
var objNode;
//Handler for previous node to turn off the button
if (sPrevNodeName != "")
{
objNode = XDocument.DOM.selectSingleNode("//" +
sPrevNodeName);
SetCommentsVisibility(false);
}//end if ""
//Handler for current node to turn on the button
objNode =
eventObj.Context.selectSingleNode("parent::*").nodeName;
SetCommentsVisibility(true);
//Establishment of current node as previous for next time
sPrevNodeName =
eventObj.Context.selectSingleNode("parent::*").nodeName;
}//end if StandardItems
return;
}//end if ContextNode
}
Thanks everyone!
Best,
- EG
P.S. Not sure what protocol is with code snippets, you might want to
paste into Notepad in order to see minus the carriage returns.