angular ng-repeat more than 1 alias - angularjs

Is possible more than 1 alias in ng-repeat follow example ?
ng-repeat="dt in data | limitTo: reportCtrl.rowsLimit as rows1 | limitTo: reportCtrl.tableParams.rowsLim: (reportCtrl.tableParams.currentPage - 1) * reportCtrl.tableParams.rowsLim as rows2"

Related

How to iterate over Presto ARRAY(MAP(VARCHAR, VARCHAR))

I have an array of maps (unordered key-value pairs), and would like to filter out any map items in the array that do not have either a created or a modified date before 2019-01-01. Is there a way to accomplish this in presto without nested tables (I have to iterate over multiple columns that are structured in this way)?
BEFORE
+-----------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+--+--+
| Category1 | Count_Items | Item_Details | | |
+===========+=============+============================================================================================================================================================+==+==+
| Fruit | 3 | [{"created":"2019-09-15","color":"red","name":"apples"},{"name":"bananas","created":"2018-08-20"},{"modified":"2019-02-01","name":"kiwi","color":"green"}] | | |
| Vegetable | 2 | [{"color":"green","modified":"2018-01-01","created":"2019-03-31","name":"kale"},{"name":"cauliflower","created":"2019-01-02"}] | | |
+-----------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+--+--+
AFTER
+-----------+-------------+----------------------------------------------------------------------------------+--+--+
| Category1 | Count_Items | Item_Details | | |
+===========+=============+==================================================================================+==+==+
| Fruit | 1 | [{"name":"bananas","created":"2018-08-20"}] | | |
| Vegetable | 1 | [{"color":"green","modified":"2018-01-01","created":"2019-03-31","name":"kale"}] | | |
+-----------+-------------+----------------------------------------------------------------------------------+--+--+
You need to use array filter -- you have array(map) and want to have array(map). For this, you need to construct the filter function for the filter (a lambda).
(Let me know if you need more detailed instructions.)

how to create multi items with 3 columns and be responsive

I am wanting to create a layout that has 2 items side by side and each item has 3 columns. The 1st and 2nd columns are fixed width and the 3rd column needs to fill the rest of the width and grow in height as needed for text. These 2 side by side items would be a 50% split of items parent div. Something like below.
------------------------------------------- -------------------------------------------
| col1 | col2 | col 3 with copy that wraps | | col1 | col2 | col 3 with copy that wraps |
| when there is lots of text | | when there is lots of text |
| in this column | | in this column |
------------------------------------------- -------------------------------------------
or like this when parent div is smaller
-------------------------------- --------------------------------
| col1 | col2 | col 3 with copy | | col1 | col2 | col 3 with copy |
| that wraps when | | that wraps when |
| there is lots of | | there is lots of |
| text in this | | text in this |
| column | | column |
-------------------------------- --------------------------------
This is close but I really do not want to use percentage on the width of the 3rd column for the text.
https://jsfiddle.net/fractorr/htzyLupz/4/
If you use bootstrap, you can use the column division method to make the layout side by side
<div class="row">
<!-- first item -->
<div class="col-md-6">
<div class="row">
<!-- make column inside the outer column -->
<div class="col-md-3">
<!-- col1 -->
</div>
<div class="col-md-3">
<!-- col2 -->
</div>
<div class="col-md-6">
<!-- col 3 with wording -->
</div>
</div>
</div>
<!-- second item -->
<div class="col-md-6">
<div class="row">
<!-- make column inside the outer column -->
<div class="col-md-3">
<!-- col 1 -->
</div>
<div class="col-md-3">
<!-- col 2 -->
</div>
<div class="col-md-6">
<!-- col 3 with wording -->
</div>
</div>
</div>
</div>
Each row will consider as col-md-12. Plan on how you want to use the column size by adjusting the column size. 12 is max. Half is 6 and so on. Hope it help you.

AngularJS repeat with table and rowspan

Say I have the following data structure
* Key 1
* Value 1
* Value 2
* Key 2
* Value 3
* Value 4
* Value 5
How, with AngularJS, can I render it in a table similar to the following:
|-------|---------|
| Key 1 | Value 1 |
| |---------|
| | Value 2 |
|-------|---------|
| Key 2 | Value 3 |
| |---------|
| | Value 4 |
| |---------|
| | Value 5 |
|-------|---------|
The keys are done via rowspan.
Nice and tricky question!
One way to do it would be:
Given an object like this:
$scope.testData={
key1:[1,2],
key2:[3,4,5]
};
You could do this:
<table>
<tr ng-repeat-start="(key, val) in testData">
<td rowspan="{{val.length}}">{{key}}</td>
<td>{{val[0]}}</td>
</tr>
<tr ng-repeat-end ng-repeat="value in val.slice(1)">
<td>{{value}}</td>
</tr>
</table>
Example

Check whether SelectBox has items, Robot-Framework, Selenium2Library

How can I check whether a <select> box has more than 1 <option>?
The <option>s are loaded using ajax and are placed into two <optgroup>s.
<option value="">default</option>
<optgroup ...>
<option value=..>...
<option ..>...
...
</optgroup>
<optgroup ...>
<option ..>...
<option ..>...
...
You can use Get List Items which will return a list of all items and then use Get Length to get the number of elements in the list:
Select Options Test
Open Browser your_url chrome
#{items} Get List Items id=select_list_id
${list_length} Get Length ${items}
Should Be True ${list_length} > 1
You have at least a couple of choices:
use the Get Matching Xpath Count keyword to return the number elements that match an xpath which represents the options, or
Use Get List Items to fetch all of the items, then use Get Length to return the length.
Since I can't write an example against your exact code, the following example runs against the page at http://the-internet.herokuapp.com/dropdown. It has markup that includes this (at the time I write this answer):
<select id='dropdown'>
<option value="" disabled="disabled" selected="selected">Please select an option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
Here is a complete working example:
*** Test Cases ***
| Example
| |
| | Go to | ${ROOT}/dropdown
| |
| | ${count}= | Get matching xpath count | //select[#id='dropdown']/option
| | Should be equal as numbers | ${count} | 3
| |
| | #{items}= | Get list items | //select[#id='dropdown']
| | ${item count}= | Get Length | ${items}
| | Should be equal as numbers | ${item count} | 3
*** Settings ***
| Library | Selenium2Library
| Suite Setup | Open browser | ${ROOT} | ${BROWSER}
| Suite Teardown | Close all browsers
*** Variables ***
| ${BROWSER} | chrome
| ${ROOT} | http://the-internet.herokuapp.com

angularjs and template table

I would like to build an html table based on a model.
I want to do something like that:
Student | competence 1 |
| subject 1 | subject 2|
| exam 1 | exam2 | average | |
xxxxx yyyyyyyyy | 10 | 20 | 15 | 45 |
And here is how I'm trying to do this:
table(ng-controller="ExaminationListCtrl")
tr
th(ng-repeat="(competence, s) in competenceToSubjectSize", colspan="{{s.length}}")
{{competence}}
tr
th(ng-repeat="subject in subjects")
{{subject.subject}}
My issue is that I can't use colspan="{{s.length}}", it seems to me that "competence" and s are only bound to the child of th elements
How could I achieve this?
I was wrong since the top tag we could access to the scope marked with the ng-repeat

Resources