struts <logic:equal > inside a <logic:iterate> - struts

I'm using struts logic:iterate and I want to do something different if my indexId is equal to 1 but I can't figure out a logic combination to say if indexId == 1 do something.
there is a way to use <logic:equal> on the indexId ?

Use JSTL over the S1 tags when functionality overlaps.
Doesn't <logic:equal name="nameOfIndexIdVar" value="1"/> work?

Related

Vue 3: Conditional v-if on hmtl attributes

I'm trying to conditional rendering an HTML Elements attribute:
EG:
<InputNumber v-model:value="example[index].number"
:min="collector.attr[0] ? collector.attr[0] : 0"
:max="collector.attr[1] ? collector.attr[1] : 0"
:step="0.01"
style="min-width: 120px;"/>
The Problem: the minimum Value of 0 is set (collector.attr[0] = null), but I want eg. that user is able to enter '-100'
The Goal: if the collector.attr[1] is "null" i want to remove the ":min" attribute - resp. only allow this attribute, if there is a minimum value set.
Like so:
<InputNumber
v-if="collector.attr[0]" => then :min="collector.attr[0]"
/>
Thank you very much for your help :)
Probably you can set a minimum value beyond which a user is not expected to input anything. Something like this
<InputNumber :min="collector.attr[0] ? collector.attr[0] : -Number.MAX_VALUE" />
Where Number.MAX_VALUE is maximum allowed float value in java script, so adding - in it makes it negative.

How to get table column count when specifying custom bottom-row?

I have the following table
<b-table
ref='table'
:fields='fields'
:items='provider'
:busy.sync='isBusy'
>
<template v-slot:bottom-row>
<!-- TODO: Is it possible to not hardcode it? -->
<b-td colspan='7' class='text-center'>
<b-spinner></b-spinner>
</b-td>
</template>
</b-table>
Is it possible to somehow get the column count and use it in the colspan instead of hardcoded 7? I presume I can use some convoluted logic with a custom prop to cover this but there's probably a better approach. I can also use e.g. 999999 which surprisingly works.
I've tried colspan='fields.length' but that wouldn't work.
You were so close with your try
In order for vue to understand that you want to pass a variable as the attribute value, you need to add a colon in front of it, like so:
<b-td :colspan='fields.length' class='text-center'>
If you do it like this:
<b-td colspan='fields.length' class='text-center'>
colspan would parse the fields.length as a string "fields.length", not the javascript computed value for the variable fields.length 7 for example.

ngx-datatable - how to define 'cell class' for columns at runtime

<ngx-datatable
id="ngxdatatable"
class='material striped'
[rows]="rows"
[columns] ="columns"
>
</ngx-datatable>
I tried to bind columns, which columns are getting at run time using columns properties from class object.
I want to style a specific column using cell class using css. How this can be achieved. Please help
I would recommend looking at some of the source code for styling header and column cells as well as how to create column templates, such as:
https://github.com/swimlane/ngx-datatable/blob/master/demo/basic/css.component.ts and https://github.com/swimlane/ngx-datatable/blob/master/demo/basic/row-detail.component.ts
You can style the column headers by adding the [headerClass]="insertYourCssClassName" inside the column template tag like this:
<ngx-datatable-column
name="ID"
prop="id"
[headerClass]="insertYourCssClassNameHere"
>
Same thing goes for styling the body cells, only with [cellClass] instead of [headerClass].

Need to get the ID value of sub-element in protractor

I am trying to automate test case using Protractor and Jasmine. The problem is I have an "article" web element tag that gets created at runtime and this web-element has a as sub element. This div element has a "id" tag associated with it. The structure of the code is below.
<article class="a b c d" data-ng-repeat="xyz repeat">
<div id="THIS IS WHAT I WANT" class="class name">
</article>
Now I am able to get get hold of the article web-element. but I am not able to get the ID attribute in the div. The ID values is generated dynamically. Kindly suggest how I can get the ID value.
Thank you
You can use a CSS Selector like this:
article > div
This will get you a div inside of an article. Now you can use this to play around and specify the selector further with classes or other stuff.
If you managed to get the div element you can then pull out the idea using (not sure if the syntax is correct but you should get the idea):
element.getAttribute('id')
1) element(by.xpath(//div[#class='class name'])).getAttribute('id')
2) element(by.xpath(//article [#class='abcd']//div[#id='THIS IS WHAT I WANT'])).getAttribute('id')
You can use chains like this:
element(by.classname('')).element(by.className('classname'));
or
element(by.css('css of parent')).element(by.css('child css'));
or you can use element(by.repeater('repeat in reapeats')).element(by.css(''));

Get an XML Element via XPath when attributes are irrelevant

I'm looking for a way to receive a XML Element (the id of an entry) from a YouTube feed (e.g. http://gdata.youtube.com/feeds/api/users/USERNAME/uploads).
The feed looks like this:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007" gd:etag="W/"DUcFQncyfCp7I2A9WhVUFE4."">
<id>tag:youtube.com,2008:user:USERNAME:uploads</id>
<updated>2012-05-19T14:16:53.994Z</updated>
...
<entry gd:etag="W/"DE8NSX47eCp7I2A9WhVUFE4."">
<id>tag:youtube.com,2008:video:MfPpj7f6Jj0</id>
<published>2012-05-18T13:30:38.000Z</published>
...
I want to get the first tag in entry (tag:youtube.com, 2008 ...).
After googling for some hours and looking through the GDataXML wiki, I'm clueless because neither XPath nor GData could deliver the right element.
My first guess is, they can't ignore the attributes in the feed and entry tags.
A solution using XPath would be great, but one in Objective-C is equally welcome.
You might be having an issue trying to get XPath to work because of the default namespace.
If you just want the first tag in entry, you can use this:
/*/*[name()='entry']/*[1]
If you want the first id specifically, you can use this:
/*/*[name()='entry']/*[name()='id'][1]
Also if you can use XPath 2.0, you can skip the predicate entirely and use * for the namespace prefix:
/*/*:entry/*:id[1]