Binding Null Placeholder not translated in view based NSTableView - nstableview

I have a view based NSTableView whose content is bound to an array controller. I bind one specific text field using objectValue.title. This works fine. I also have set a null placeholder for that binding which is indeed displayed when the value is null. However, it does NOT use translated values of the null placeholder.
The identifier for the placeholder is je1-iU-XEu.ibShadowedIsNilPlaceholder and the corresponding translation is je1-iU-XEu.ibShadowedIsNilPlaceholder" = "Stationsname";.
If I do the same with a cell based table view, it works. Any idea why this is not working?

I'm having this bug today. Seems that Apple didn't care about fixing it.
If you use localized strings, then you might have to dive in the storyboard code and ensure the object ids are matching.
In your storyboard, you will see an element with key "NSNullPlaceholder", wrapped into another one with id "Ds1-Gj-yzu". (See the code below)
Go to your string file and ensure you have something like
"Ds1-Gj-yzu.ibShadowedIsNilPlaceholder" = "Your translation";
WARNING: each time you will change the placeholder value in the storyboard, a new ID is generated, breaking at the same time the localization.
<connections>
<binding destination="TyA-Z9-mxH" id="Ds1-Gj-yzu" keyPath="objectValue.group" name="value">
<dictionary key="options">
<string key="NSNullPlaceholder">Group</string>
</dictionary>
</binding>
</connections>

Related

Asp.net textbox shows text and value differently

I am populating the value of a text box using javascript document getElementById.
I am able to see the text change in UI. However in code behind it shows a different value. I did inspect element on the input and saw the value and text are showing differently. How is this possible.
This is what I see on inspect element Value = '19 Bradston Street (South Bay)' but the UI shows ' 35-49 East Santa Clara Street' :-
<input name="ctl00$ContentPlaceHolder1$CtlPropertySales$txtBuildingName" type="text" value=" 19 Bradston Street (South Bay)" id="ctl00_ContentPlaceHolder1_CtlPropertySales_txtBuildingName" tabindex="95" style="font-family:tahoma,verdana;font-size:11px;font-weight:normal;height:16px;width:150px;">
This is the Javascript code that is setting the value:-
document.getElementById('<%=CtlPropertySales.FindControl("txtBuildingName").ClientID%>').value = params[1]
Can any one tell me how this is possible and how I can solve this.
It looks like you might not be getting the ID properly. You're looking for
<%=CtlPropertySales.FindControl("txtBuildingName").ClientID%>
but what is the ID for CtlPropertySales? Try getting the ClientID of CtlPropertySales first, then get the ClientID of txtBuildingName.
Or just
document.getElementById('<%=ctl00_ContentPlaceHolder1_CtlPropertySales_txtBuildingName.ClientID%>').value= params[1]
You might consider add this to your web.config:
<system.web>
<pages clientIDMode="Static">
</system.web>
With clientIDMode="Static", IDs will retain their original name and you will not need to use ctl00 or ClientID any more. That should help with setting values, but it will affect all the IDs in the app/site and you'll have to update scripts.

Sterling Map Editor : Conditional Null Value

I have a XML to XML map on IBM Sterling B2B Integrator map.
I am trying to set an empty tag on a conditional variable as follows:
empty($my_var[counter][1].#my_var);
The result is that on output the empty tag does not show up.
Expected result:
<my_var/>
Is there any way to achieve this?
The XML element should be declared as mandatory in the map.
The PCDATA property should not have Mandatory checked if it is not required, but the element level should be mandatory.
Note also this known problem:
http://www-01.ibm.com/support/docview.wss?uid=swg21701246

Binding an inputText value to a viewScope with a computed name

I have an inputText component on a custom control and I am trying to bind the value to a viewScope, but the viewScope name is computed using a compositeData value and string.
If I hardcode the value binding it works, for example:
value="${viewScope['BillingDate_From']}"
The viewScope name is computed using the following javascript code:
compositeData.dateRangeFilter[0].from_fieldname + '_From'
I have tried many ways of achieving this but with no success, sometimes it errors, usually unexpected character errors but most of the time the inputText box is empty.
The code I have most recently tried:
value="${viewScope[#{javascript:compositeData.dateRangeFilter[0].from_fieldname + '_From'}]}"
I have found, and I don't know the reason for this, that trying to bind dynamically doesn't work if there's any string concatenation in the evaluation. The way I got around this was by creating a custom control that accepts a bindingValue and dataSource as parameters, then passing in the document and field name I want to use. For whatever reason, if the code uses composite data, it still allows for editing when the page loads.
Hi try this to build what you need:
The Control:
<xp:inputText id="inputText1">
<xp:this.value><![CDATA[${javascript:"#{"+compositeData.scopeName+"}";}]]></xp:this.value>
</xp:inputText>
<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[${javascript:"#{"+compositeData.scopeName+"}";}]]></xp:this.value>
</xp:text>
The XPage using the Control:
<xc:cc id="xx">
<xc:this.scopeName><![CDATA[#{javascript:return "viewScope." + " calculatedScopeVarName";}]]></xc:this.scopeName>
</xc:cc>
<xp:button value="Beschriftung" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="xx">
<xp:this.action><![CDATA[#{javascript://}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
Instead of "viewScope" you cant add session or another scope and instead of calculatedScopeVar you can enter the name of your var. But this has a limit, it only works if the calculatedScopeVar is accesable through the component onLoad. For example it will not work if you use this control in a Repeat control and try to use the repeated array as calculatedScopeVar.

jqGrid: dataurl not working

I'm new to both jQuery and jQGrid. I tried to populate a dropdown combobox in the grid with data coming from server, I'm in java servlet environment.
I used dataUrl method and many others but still no luck with populating combo.
my js looks like:
...
{name:'idTipologia',index:'idTipologia', width:80,editable: true,edittype:"select",editoptions:{dataUrl: "/sohara/comboTipologiaAction.do"}...
...
my server side code basically is:
take a list from server, format data (whether json or not), open a PrintWriter, write info in it.
I tried both JSON conversion and plain text from Firebug I can see the response correctly formatted ("1:VALUE1;2:VALUE2")but the dropdown remains empty.
My question is:
Is there a peculiar way to organize the data in order to make this combo population?
Any help appreciated.
According to the jqGrid documentation, your problem is that the dataUrl needs to return HTML containing the SELECT element, not JSON:
The editoptions dataUrl parameter is valid only for element of edittype:select. The dataUrl parameter represent the url from where the html select element should be get.
When this option is set, the element will be filled with values from the AJAX request. The data should be a valid HTML select element with the desired options - something like:
<select>
<option value='1'>One</option>
<option value='2'>Two</option>
...
</select>
So the easiest solution is for you to just return HTML.
That said, I do not like the idea of returning UI elements directly. Another option is to use the buildSelect function to construct the SELECT element for you:
This option is relevant only if the dataUrl parameter is set. When the server response can not build the select element, you can use your own function to build the select. The function should return a string containing the select and options value(s) as described in dataUrl option. Parameter passed to this function is the server response
This answer provides an example of how to use buildSelect.

Deleting / Replacing A Node in E4X (AS3 - Flex)

I'm building a listing/grid control in a Flex application and using it in a .NET web application. To make a really long story short I am getting XML from a webservice of serialized objects. I have a page limit of how many things can be on a page. I've taken a data grid and made it page, sort across pages, and handle some basic filtering.
In regards to paging I'm using a Dictionary keyed on the page and storing the XML for that page. This way whenever a user comes back to a page that I've saved into this dictionary I can grab the XML from local memory instead of hitting the webservice. Basically, I'm caching the data retrieved from each call to the webservice for a page of data.
There are several things that can expire my cache. Filtering and sorting are the main reason. However, a user may edit a row of data in the grid by opening an editor. The data they edit could cause the data displayed in the row to be stale. I could easily go to the webservice and get the whole page of data, but since the page size is set at runtime I could be looking at a large amount of records to retrieve.
So let me now get to the heart of the issue that I am experiencing. In order to prevent getting the whole page of data back I make a call to the webservice asking for the completely updated record (the editor handles saving its data).
Since I'm using custom objects I need to serialize them on the server to XML (this is handled already for other portions of our software). All data is handled through XML in e4x. The cache in the Dictionary is stored as an XMLList.
Now let me show you my code...
var idOfReplacee:String = this._WebService.GetSingleModelXml.lastResult.*[0].*[0].#Id;
var xmlToReplace:XMLList = this._DataPages[this._Options.PageIndex].Data.(#Id == idOfReplacee);
if(xmlToReplace.length() > 0)
{
delete (this._DataPages[this._Options.PageIndex].Data.(#Id == idOfReplacee)[0]);
this._DataPages[this._Options.PageIndex].Data += this._WebService.GetSingleModelXml.lastResult.*[0].*[0];
}
Basically, I get the id of the node I want to replace. Then I find it in the cache's Data property (XMLList). I make sure it exists since the filter on the second line returns the XMLList.
The problem I have is with the delete line. I cannot make that line delete that node from the list. The line following the delete line works. I've added the node to the list.
How do I replace or delete that node (meaning the node that I find from the filter statement out of the .Data property of the cache)???
Hopefully the underscores for all of my variables do not stay escaped when this is posted! otherwise this.&#95 == this._
Thanks for the answers guys.
#Theo:
I tried the replace several different ways. For some reason it would never error, but never update the list.
#Matt:
I figured out a solution. The issue wasn't coming from what you suggested, but from how the delete works with Lists (at least how I have it in this instance).
The Data property of the _DataPages dictionary object is list of the definition nodes (was arrived at by a previous filtering of another XML document).
<Models>
<Definition Id='1' />
<Definition Id='2' />
</Models>
I ended up doing this little deal:
//gets the index of the node to replace from the same filter
var childIndex:int = (this._DataPages[this._Options.PageIndex].Data.(#Id == idOfReplacee)[0]).childIndex();
//deletes the node from the list
delete this._DataPages[this._Options.PageIndex].Data[childIndex];
//appends the new node from the webservice to the list
this._DataPages[this._Options.PageIndex].Data += this._WebService.GetSingleModelXml.lastResult.*[0].*[0];
So basically I had to get the index of the node in the XMLList that is the Data property. From there I could use the delete keyword to remove it from the list. The += adds my new node to the list.
I'm so used to using the ActiveX or Mozilla XmlDocument stuff where you call "SelectSingleNode" and then use "replaceChild" to do this kind of stuff. Oh well, at least this is in some forum where someone else can find it. I do not know the procedure for what happens when I answer my own question. Perhaps this insight will help someone else come along and help answer the question better!
Perhaps you could use replace instead?
var oldNode : XML = this._DataPages[this._Options.PageIndex].Data.(#Id == idOfReplacee)[0];
var newNode : XML = this._WebService.GetSingleModelXml.lastResult.*[0].*[0];
oldNode.parent.replace(oldNode, newNode);
I know this is an incredibly old question, but I don't see (what I think is) the simplest solution to this problem.
Theo had the right direction here, but there's a number of errors with the way replace was being used (and the fact that pretty much everything in E4X is a function).
I believe this will do the trick:
oldNode.parent().replace(oldNode.childIndex(), newNode);
replace() can take a number of different types in the first parameter, but AFAIK, XML objects are not one of them.
I don't immediately see the problem, so I can only venture a guess. The delete line that you've got is looking for the first item at the top level of the list which has an attribute "Id" with a value equal to idOfReplacee. Ensure that you don't need to dig deeper into the XML structure to find that matching id.
Try this instead:
delete (this._DataPages[this._Options.PageIndex].Data..(#Id == idOfReplacee)[0]);
(Notice the extra '.' after Data). You could more easily debug this by setting a breakpoint on the second line of the code you posted, and ensure that the XMLList looks like you expect.

Resources