Writing conditional expressions in offset attribute of logic:iterate tag for struts 1.3 - struts

I want to write a condition in the offset attribute of logic:iterate tag in struts1.3. My tag looks like this
logic:iterate name="instlist" id="inst" type="com.umonitor.fundstransfer.beans.FtInstitution" indexId="counter"
I want to set the offset value to every 8th element in the list.
Is that possible? I wanted to implement paging but the problem is I cant change the action class or add any but only manipulate the values in the jsp. I have the complete list in the jsp and have to display 8 rows only in the page.

Have you looked at the 'offset' and 'length' attributes of logic:iterate? http://struts.apache.org/1.x/struts-taglib/tlddoc/logic/iterate.html
These attributes will enable you to start at a certain position (offset) and then show only the next 8 entries (length).
In your case I guess you have a parameter called something like 'page' and you'll need to set the offset to page*8 and the length to 8.

Related

Apex, Dynamic action, Confirm action, not picking up correct text - what am I missing?

I'm obviously missing something and hoping someone might be able to help.
I've an Interactive Grid, and a button.
When the button is pressed the dynamic action on the button has 2 steps.
Action 1 - Execute Javascript to take a value from one of the IG cells and put it into a page item.
Action 2 - Confirm Action - Are you sure you wish to delete &P10_JOB_ID.
I've made the page item, &P10_JOB_ID, visible and I can see the value has correctly been changed to the value from the IG.
I write P10_JOB_ID into a database table - I get the correct value
But the confirm message isn't picking up the correct value from P10_JOB_ID.
Namely it uses the value in P10_JOB_ID when the page starts, but then as I move around the IG pressing the button and changing the value of P10_JOB_ID, the text in the confirm message never changes.
Can anyone suggest what I might have missed, I'm baffled.
Thanks a lot
Substitutions like &P10_JOB_ID. are made when the page is rendered, not dynamically, so reflect the value at time of page load.
You will need to use Javascript to perform the conform action, something like:
apex.page.confirm ('Are you sure you wish to delete ' + $v('P10_JOB_ID') + '?', 'DELETE');
$v is an APEX Javascript function that returns the current value of a page item.
I used 'DELETE' as an example of a request value; you may want to do something different here.
Ok - having the setting of value and confirm as 2 separate actions is what causes the problem.
As per fac586
That is the expected behaviour. Static text substitutions are performed once during page show processing. They are not evaluated dynamically in the browser at runtime as values change.
Drop the second action and extend the first to display the confirm dialog using the apex.message.confirm JS API method, accessing the item value using the $v shorthand method.

XPath selector returns empty list

I'm trying to scrape data from store: https://www.tibia.com/charactertrade/?subtopic=currentcharactertrades&page=details&auctionid=12140&source=overview
There is no problem with getting data from 1st and 2nd table, but when I goes down, xpath returns only empty lists.
even tried to save response in file:
scrapy fetch --nolog "https://www.tibia.com/charactertrade/?subtopic=currentcharactertrades&page=details&auctionid=3475&source=overview" > response.html
for table with skills everything works good
sword = response.xpath('//div [#class="AuctionHeader"]/a/text()').get()
but when it comes to getting for example gold value, I get only empty list:
gold = response.xpath('/html/body/div[3]/div[1]/div[2]/div/div[2]/div/div[1]/div[2]/div[5]/div/div/div[3]/div[2]/div[2]/table/tbody/tr/td/div/table/tbody/tr[2]/td/div[2]/div/table/tbody/tr[3]/td/div/text()').get()
In chrome/firefox both selectors works smooth, but in scrapy only 1st one
I know there might be some problems with data updated by javascript, but it doesn't look like this case
Doesn't look like it's a javascript problem. Think you're not getting your XPATH selectors correct. It's best to be as specific as possible and not to use multiple nodes down. Here we can select the attribute TableContent to get the tables you want. There you can select each individual table that you require if needed.
Code Example
table = response.xpath('//table[#class="TableContent"]')[3]
gold_title = table.xpath('tr/td/span/text()')[2].get()
gold_value = table.xpath('tr/td/div/text()')[2].get()
output
'Gold: '
'31,030'
Explanation
Using the class attribute TableContent, you can select which table you want. Here I've selected the table with the gold values. I've then selected each row and the specific element which has the gold value. The values are hidden behind span and div elements. get() returns a string, getall() returns a list.

PEGA SLIDER - and get refresh property

I got a requirement to do a slider in PEGA.
The issue is that I do not manage to get the field/property refreshed with the slider value. I need to use this property in a declare expression and in conditional visibility (layout).
I am looking for something like the autocomplete where the value is refresh without submitting.
Any idear will be welcome.
THX.
Ok, I have solved the issue. In order to actualise the property .Amount outside the layout, I needed to configure an action on the first layout. The one holding the slider. In this layout -> in actions : add an event: Change and Add an Action : Refresh-This section / Target Section.
The value is then dynamicly refreshed in the clipboard too.
PS : in order to have different step value inside the same slider (ex: from 0 to 10 step = 1, form 10 to 30 step = 3 ... ) just use a property in the Slider Parameters 'step' of the slider and link this property to a declare expression. Within the declare expression you can configure as much step as you want.

How to identify webelement using partial attribute of id?

I have to find xpath for a textbox using id attribute. However, a portion of the attribute keeps changing every time I login to the application which I'm automating and the remaining portion remains unchanged. PFB example -
Attribute ------> id="StringJob_value_1102199569"
Here, the numeric value changes during every login and the portion "StringJob_value" remains unchanged.
Hence, is there any way in selenium to only use the constant portion of the attribute to identify the web element(Text Box)?
Try the following xpath:
//*[contains(#id, 'StringJob_value_')]

How to specify page size in dynamically in yii view?

How to specify page size in dynamically in yii view?(not a grid view)
In my custom view page there is a search option to find list of users between 2 date
i need 2 know how to specify the page size dynamically? If number of rows less than 10 how to hide pagination ?
please check screen-shoot
I dont want the page navigation after search it confusing users..
my controller code
$criteria=new CDbCriteria();
$count=CustomerPayments::model()->count($criteria);
$pages=new CPagination($count);
// results per page
$pages->pageSize=10;
$pages->applyLimit($criteria);
$paymnt_details=CustomerPayments::model()->findAll($criteria);
$this->render('renewal',array('paymnt_details'=>$paymnt_details,'report'=>$report,'branch'=>$branch,'model'=>$model,'pages' => $pages,));
}
my view
Link
I'm assuming you want the entire list of search result be shown on a single page, no-matter how long it is?
If so, this is quite easy to achive.
As I can see in your code, you are now defining your pageSize to have a size of 10. You can update it to be dynamically be doing this:
$pages->pageSize = $count;
To remove the pagesizes you can change the css of your view file, but for that we would need your view file to see how you defined it.