I'm trying to achieve the following result: I have a set of values that are coming from an array which I iterate over in order to populate an HTML table. As well I have an icon that user can hoover-over and can see data in there coming from the array and a translation key coming from translation files.
I want to bind a second argument to the TCustomAttribute in order to display to the user another data that was edited by them.
How do I achieve this in Aurelia?
<template>
<table>
<thead>
<th><span>Id</span></th>
<th><span>Name</span></th>
<th><span>Description</span></th>
<th><span>Date</span></th>
</thead>
<tbody>
<tr repeat.for="item of data">
<td><span>${item.Id}</span></td>
<td><span>${item.Name}
<a data-toggle="popover" t="[data-content]pending_name ${data.Name}" data-trigger="hover">
<i class="fa fa-info-circle"></i>
</a>
</span></td>
<td><span>${item.Description}</span></td>
<td><span>${item.Date}</span></td>
</tr>
</tbody>
</table>
</template>
Take a look at the t-params attribute which allows you to pass in additional parameters. More about that in the official guide http://aurelia.io/docs/plugins/i18n#using-the-plugin
Related
I want to append an element to a specific element when the user clicks the button. The scenario goes like this. Is there another way to deal with that kind of problem?
<table>
<tbody>
<tr>
<td>
One
<button>delete</button>
<button x-on:click="edit(passIdToFunc)">edit</button>
</td>
</tr>
<tr id="one" style="display: hidden"></tr>
<!-- append x-teleport dom node to here when current value is id = one -->
<tr>Two</tr>
<tr id="two" style="display: hidden"></tr>
<tr>Three</tr>
<tr id="three" style="display: hidden"></tr>
...
</tbody>
</table>
<!--
For the initial render, or if there is no table data,
I would like to append it to somewhere else with display none.
-->
<template x-teleport="computedString">
...
</template>
This looks like the wrong usage for x-teleport, though it's not clear from the example where you are teleporting to. You can just use x-show to toggle display:none if that's what you're looking for.
I need to modify the format of a form in a model-driven app to make it more readable/intuitive. Currently, the form looks like this:
I tried to use a web resource to create a simple HTML table with <script> and Xrm.Page.getAttribute() to pull in the relevant fields under the planned and actual columns, but that isn't working. I set the dependencies and assigned it to the proper form element, but no luck. The code that I used is this:
<div>
<table>
<tr>
<td><u>Tasks</u></td>
<td><u>Planned</u></td>
<td><u>Actual</u></td>
</tr>
<tr>
<td>Task 1</td>
<td><script>Xrm.Page.getAttribute("[plannedField_1]")</script></td>
<td><script>Xrm.Page.getAttribute("[actualField_1]")</script></td>
</tr>
<tr>
<td>Task 2</td>
<td><script>Xrm.Page.getAttribute("[plannedField_2]")</script></td>
<td><script>Xrm.Page.getAttribute("[actualField_2]")</script></td>
</tr>
<tr>
<td>Task 3</td>
<td><script>Xrm.Page.getAttribute("[plannedField_3]")</script></td>
<td><script>Xrm.Page.getAttribute("[actualField_3]")</script></td>
</tr>
</table>
</div>
Is this a valid way to modify form output, or is there another/better way to do this that doesn't involve creating an elaborate solution with dynamically scripted HTML?
Uncheck the Display label on the form for one of the controls.
I have table like below without any id.
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Delete</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td><a><i class="btn red">close</i> </a></td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td><a><i class="btn red">close</i> </a></td>
</tr>
<tr>
<td>ABC Products</td>
<td>Menu Perrita</td>
<td><a><i class="btn red">close</i> </a></td>
</tr>
</table>
I need to click on the Close (X) button of the 2nd row. Which is in Centro comercial Moctezuma. This row is not display at 2nd always. It can be at any place. But I need to click on the particular Close button to delete the mentioned row for a selenium test.
Please help me in writing the xpath to identify the particular button.
Thanks
You can do this using the following XPath
//td[text()='Centro comercial Moctezuma']/following-sibling::/td//i[text()='close']
Something like this:
//tr[td = 'Centro comercial Moctezuma']/td/a
Have a table with the filtering and sorting like so:
<tbody>
<tr class="row"
repeat.for="repo of repos |
filter:searchField.value:filterGitHubTable |
sort: {propertyName: column.value, direction: direction.value} |
pageData:{currentPage: pageNumber, pageSize:pageSize}">
<td class="col-xs-3">${repo.name}</td>
<td class="col-xs-3">${repo.stargazers_count}</td>
<td class="col-xs-3">${repo.forks_count}</td>
<td class="col-xs-3">${repo.open_issues}</td>
</tr>
</tbody>
In my pager code below its setup as
<pagination model.bind="repos"
page-size.bind="pageSize"
pageclick.delegate="handlePageClick($event)"
pagination-class="pg-bluegrey"></pagination>
How to make the pagination element model bind to the reference of a filter result 'after the sorting' but 'before it does the next filter for pagination data'?
The reason is once have pagination data, I don't have the whole filter result to bind with the pagination element. How would I keeping track of page numbering when applying the filter on the table result?
Here's a little trick you might be able to use here. You can use a hidden HTML element to sort of "hold on" to an intermediate version of your data. Aurelia allows you to attach arbitrary attributes to any element, and by using the ref attribute, we can attach the element itself to our viewmodel. We can then access any data we've attached to this element anywhere we want in our view or viewmodel. Check this out:
<input type="hidden" ref="filteredAndSorted"
data.bind="repos |
filter:searchField.value:filterGitHubTable |
sort: {propertyName: column.value, direction: direction.value}" />
<table>
<tbody>
<tr class="row" repeat.for="filteredAndSorted.data |
pageData:{currentPage: pageNumber, pageSize:pageSize}">
<td class="col-xs-3">${repo.name}</td>
<td class="col-xs-3">${repo.stargazers_count}</td>
<td class="col-xs-3">${repo.forks_count}</td>
<td class="col-xs-3">${repo.open_issues}</td>
</tr>
</tbody>
</table>
<pagination model.bind="filteredAndSorted.data"
page-size.bind="pageSize"
pageclick.delegate="handlePageClick($event)"
pagination-class="pg-bluegrey">
</pagination>
I'm betting this is what will help you. Sorry it took so long to answer, I've been quite busy the last few days doing Aurelia training.
I want to create an xpath for clicking on "run " (4th column) based on the first column value (xyz). the below xpath doesnt work. Can you suggest a better way of writing the xpath.
//table/tbody/tr/td[text()='xyz fix']/parent::tr/td[4]
<div id="main">
<table class="FixedLayout" width="1000px">
<tbody>
<tr></tr>
<tr>
<td class="RowHeight">
xyz
</td>
<td>xyz fix</td>
<td>1125</td>
<td>
Run
</td>
</tr>
<tr>
<td class="RowHeight">
abc
</td>
<td>abc fix</td>
<td>1125</td>
<td>
Run
</td>
</tr>
</tbody>
</table>
</div>
I don't see why your one didn't work. Please clarify what it means "doesn't work". NoSuchElementException? ElementNotVisibleException? Wrong XPath? Not clicking the link or what?
Meanwhile, try the following XPaths (but the issue could be your Selenium code instead of XPath):
Here I assume you want to the <a> link instead of <td>, because you mentioned you want to click it.
Use XPath predicate:
//*[#id='main']//table/tobdy/tr[td[text()='xyz']]/td[4]/a
Use XPath predicate with attribute selector to avoid using index.
//*[#id='main']//table/tobdy/tr[td[text()='xyz']]//a[contains(#href, 'Instance/Create')]
Use .. to get the parent
//*[#id='main']//table/tobdy/tr/td[text()='xyz']/../td[4]/a