ng-repeat causing "Error: 10 $digest() iterations reached. Aborting! when passing scope to leaflet directive - angularjs-ng-repeat

Edited: After some advices i came back to old version of how i wanted handle angular and leaflet, link to fiddler but still is not working,
Explanation: It was working with angular-leaflet-directive, but this directive has very bad performance on firefox, to compare leaflet.js self is very good so i thought i will try to make some small directive on my own, maybe somebody has some advices what is wrong and how to fix it?
Link to fiddler:
fiddler
I try to pass result from ng-repeat to leaflet directive, but when i do it, angular start "Error: 10 $digest() iterations reached. Aborting!, there is no problem when i pass just data to directive. I tried few things but without result. I cannot even see markers. If the problem is in directive?
<body ng-app="directoryAppMap">
<div ng-controller="DirectoryMapListController">
<input ng-model="search" placeholder="Name" />
<table id="table">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="hf in FilteredGeojson = (data | filter:search)">
<td>{{ hf.properties.name }}</td>
<td>{{ hf.geometry.coordinates }}</td>
</tr>
</tbody>
</table>
<div leaflet-directive id="map" data="FilteredGeojson"></div>

Related

PowerApps: Use HTML to modify form display in model-driven apps?

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.

Circumvent Boostrap-Table from rendering 100+ rows slowly

I'm rendering a list of state objects (with Spring and Thymeleaf) on my view page:
<table id="state-table" data-toggle="table" data-pagination="true" data-pagination-v-align="top" data-search="true">
<thead>
<tr>
<th data-sortable="true">ID</th>
<th data-sortable="true">Descrizione</th>
<th>Azioni</th>
</tr>
</thead>
<tbody>
<tr th:each="s : ${state}">
<td><span th:text="${s.id}"></span></td>
<td><span th:text="${s.descrizione}"></span></td>
</tr>
</tbody>
</table>
The table contains about 150 elements, but when the page is rendering I see for less than a second an ugly page (is the plugin trying to paginate the result) and I would like to avoid it.
I have already tried adding a timeout as workaround:
$(function() {
$("#state-table").bootstrapTable("showLoading");
setTimeout(function() {
$("#state-table").bootstrapTable("hideLoading");
}, 1000);
});
but with this code, when the page renders, I see a strange html page at beginning, then I see the loading message, and finally the table with all elements loaded.
I think I have to intervene before (or while) the table is created but I don't know how. What would I need to do so that the table is rendered correctly without the user noticing the ugly "un-bootstraped" table?
Try To use Pagination instead of showing all your entries.
Hope it help you : https://www.baeldung.com/spring-thymeleaf-pagination

Simple laravel 5 pagination links

In my controller I'm displaying records in a table in my View.
Controller:
$promotion = Promotions::paginate(5);
View:
<tr>
<th>Order</th>
<th>Infomation</th>
<th>Date</th>
<th>Cost</th>
<th>From</th>
</tr>
</thead>
<tbody align="center">
<?php $i = 0;?>
#foreach ( $promotion as $promo)
<?php $i++;?>
<tr>
<td data-title="Order">{{$i}}</td>
<td data-title="Infomation">{{$promo['name']}}</td>
<td data-title="Date">29/10/57</td>
<td data-title="Cost">1.99$</td>
<td data-title="From">K-Bank</td>
</tr>
#endforeach
</tbody>
It works properly when I locate manually to exampleurl/mypage?page=2
All seems well. However, I wanted to create two text buttons to go back and fourth between pages.
How can I set these to navigate the pagination back and fourth:
Previous
Next
EDIT: I don't understand why I'm getting downvoted for this question. No where can I find a tutorial on how to split the back and fourth buttons. How professional can your website be if you're restricted to placing the page links to one spot on the page? seriously...
In Laravel 5 there is a single configuration option for Eloquent models to generate pagination. So, you can use the method:
<?php echo $promotion->render(); ?>
If you want an option only with Previous and Next buttons, you need to use
$promotion = Promotions::simplePaginate(5);
Instead of
$promotion = Promotions::paginate(5);

selenium webdriver xpath generation

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

knockout 2.0 doesn't work in IE8

This view works well with IE9 and Chrome. However, not with IE8.
When the page is rendered, this is how it looks like:
My HTML (MVC3 View) is as shown below.
<div id="machinedisplay" data-bind="with: selectedMachine" >
<h2><span data-bind="text: MachineDesciption" /></h2>
<!-- ko with: my.vm.machineData -->
<table>
<thead><tr>
<th>Point Name</th><th>Description</th><th>Points Data</th>
</tr></thead>
<tbody data-bind="foreach: Points">
<tr>
<td data-bind="text: PointName()"></td>
<td data-bind="text: PointDesciption()"></td>
<td>
<table style="width:100%;">
<thead><tr>
<th>Name</th><th>Description</th><th>Value</th><th></th>
</tr></thead>
<tbody data-bind="foreach: Params">
<tr>
<td data-bind="text: ParameterName"></td>
<td data-bind="text: ParameterDescription"></td>
<td data-bind="text: StringValue"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- /ko -->
</div>
Any ideas on IE8 work around?
EDIT:
To illustrate this problem on a simpler model, check out this fiddle http://jsfiddle.net/ericpanorel/nzKvb/
I figured that I am running into problems because I am using the "with" or "if" bindings. I read somewhere that this causes problems with IE8.
I used IE9, and if you use your developer tools to switch from IE9 to IE8, this Fiddle doesn't work properly anymore. This fiddle is actually derived from one of knockout's samples (http://knockoutjs.com/examples/gridEditor.html)
EDIT:
I updated the fiddle... http://jsfiddle.net/nzKvb/20/
It has something to do with short-hand closing of tags inside the nested containerless bindings
<!-- ko if: Allowed-->
<h2>
<span data-bind="text: Dummy"/> <===== This will bomb in IE8
</h2>
The jsFiddle had an extra comma at the end of the array, which IE8 was treating as a null object:
var viewModel = new GiftModel([
{ name: "Tall Hat", price: "39.95"},
{ name: "Long Cloak", price: "120.00"},
{ name: "HK 416", price: "2420.00"}, <-- HERE !!!
]);
ko.applyBindings(viewModel);
The fiddle works fine without the comma:
http://jsfiddle.net/XPMUA/
Not sure if this solves your underlying problem but at least the fiddle is working now :-)
The problem is here because
<!-- ko if: Allowed-->
Older IE versions can be picky about using JavaScript reserved words
for property names.
So you should write 'if'
Check Same problem in another link!

Resources