#created() gives me crazy results on my xpage - xpages

strange effect for me:
a computed text with #created() gives me crazy results:
e.g. creation datetime is: 09.02.2015 21:27
the xpage shows: 07.07.2014 20:47
it is depending of the opened doc (it's not the creation date of the design element), but it does sth I do not understand.
Am I using it incorrectly?
thx, Uwe
the code goes like:
<xp:text escape="true"
id="compCreated">
<xp:this.converter>
<xp:convertDateTime
type="both" timeStyle="short">
</xp:convertDateTime>
</xp:this.converter>
<xp:this.value><![CDATA[#{javascript:#Created()}]]></xp:this.value>
</xp:text>

#Created() returns data for last defined data source (as many other functions without explicit data source reference).
Moved from comment so you can accept my answer ;-)

Frantisek Kossuth solves it (as a comment, so I answer it here): I have multiple data sources defined, and it shows the creation date of the other data source.
Thank you Frantisek

#Created returns a Date JavaScript object. You may want to handle the conversion of that to a string yourself to avoid variations based on your server's locale.
Howard

try this, if your data source is named "d"
d.getDocument().getCreated().toJavaDate()

Try using the timezone property and set it to your timezone properly. Date fields (the converters) sometimes behave weird when running on different environments that are also mixed with local browser/machine settings. I documented it here: http://oliverbusse.notesx.net/hp.nsf/blogpost.xsp?documentId=D22

Related

Flexible column layout does not work when Two Way binding

My app has a flexible column layout with the list report displayed initially, and then switch to two columns when I click on an entry in the list report. This works fine so far with one way binding with backend model. But when I switch to two way binding then the click on entry does not show the second column. I am using the following code to switch the layout to two-column.
this.byId("flexibleColumnLayout").setLayout(sLayout);
Inside the setLayout() , I see some code that speaks about two-way binding. I am not an expert though to understand that level.
Anyone has fixed such an encounter? Appreciate your help. Thanks...
this.byId("flexibleColumnLayout").setLayout(sLayout);
This is resovled. The setLayout method is triggering some code where is going through some two way binding check and did try property binding checking against backend model, which is not correct. Instead binding the control to local json model did work. Thank you all!

How to display one lookup's values depends on another lookup's value?

I want to display a set of values in one lookup's control depends on another lookup's control in same list. so what I want to do for this situation? both look ups are pointing the same list...
its like choosing states from country list... and is there any simple way?
You can use SPServices library if you are looking to do it on client side Javascript.
It has SPCascadeDropdowns function especially for this purpose.
http://spservices.codeplex.com/wikipage?title=%24().SPServices.SPCascadeDropdowns
What you are looking to do is to create a cascaded dropdown list.
Take a look at the folling link: http://www.codeproject.com/Articles/619373/Cascading-drop-downs-with-Cross-site-Lookup-for-Sh
You will need to adapt it a little bit, but it should work fine.

Cannot locate a text_field with dynamic id

<div id="temp_1333021214801">
<input type="text"/>
</div>
$browser.text_field(:xpath,".//*[#id='temp_1333018770709']/input").set("apple")
I am getting error "unable to locate element", because the ID changes dynamically.
Please help me to set the text in the text field.
It seems like your dynamic id is temp_ so this should do it given information above:
browser.div(:id, /temp_\d+/).text_field.set 'something'
Issues with my solution is that it assumes id will always be temp_ regex matching any number set consecutively, which seems to be the case with your sample above. Also, it assumes there is no other div(:id, /temp_\d+/) combination in the DOM of that page, most likely should not be an issue.
If you have dynamic IDs I can suggest the following:
Code to object counts. For example
$browser.text_field(:index => 2)
gives the third text_field on the page.
Code to what is around the thing you're trying to find.
$browser.div(:name => 'mydiv').text_field(:index=>2)
gives the third text field in the div called 'mydiv'.
HOWEVER
If your front-end is less-than-testable in this way I highly suggest you put time into thinking over your commitment to automated testing in the first place. Any minor change to the software is going to have you working until 9pm pulling your hair out and rocking back and forth as you update all your scripts, so unless code maintenance is your weekend hobby think about semi-automation or exploratory testing or manual scripts. Talk to development (whomever that might be. It might be you!) or the higher-ups (unless that's you too) to see if it can be made more testable. Also don't use xpaths unless you take some deviant pleasure in it.
Hope that was helpful, I can't do anything specific without the source HTML.

Rad grid custom filtering

How can I activate custom filtering for my radgrid?(I googled but I didn't get any proper response regarding this)
I have a property like AllowCustomSorting but I don't have any property regarding filtering.
Can any one provide the way how to implement custom filtering?
If possbile give me a sample page then I will understand.
Thanks in advance.
All you need to know about filtering:
http://www.telerik.com/help/aspnet-ajax/grid-basic-filtering.html
I usually do my filtering/sorting within my stored procedures as that brings huge speed benefits when working with larger tables.
I'm aware this is a fairly old question now but this link should help you:
Note that it has a sample project at the bottom of the page.
The property you are looking for is AllowFilteringByColumn="True"
This page has a sample using a dropdown and a custom filter.

Sharepoint/WSS: helping writing xpath conditional expression

Assuming there is some way to do this... I am using WSS 3.0 and SP Designer 2007. I've changed a list to its XSLT data view in SPD, and am trying to add a formula to display the first 250 characters of the body text, and then IF there are additional characters, add a "(more)" link to the list item.
The problem I'm running into is the conditional aspect... the following successfully adds the "(more)" text and links correctly. But I can't seem to figure out how to only execute it if the body text > 250 characters. Any ideas?
concat(substring(#Body,0,250),'... (more)')
I can use string-length(#Body) to get the length... but how do I put these together?
Thanks,
Mark
Does this help?
<xsl:choose>
<xsl:when test="string-length(#Body) &gt 250"></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
Some time ago I wrote an article on my blog about creating short descriptions (basically the same case that you're mentioning but then for the Content Query Web Part). It might help you get some answers. The article is available # http://blog.mastykarz.nl/generating-short-description-content-query-web-part/

Resources