Bruce Gust
asked on
Anybody ever heard of "leaflet.js" or "heatmap.js"?
Here's a screenshot of my page:
Here's what you're looking at:
This particular company doesn't have any address information .Within the code, there's a piece that's looking for some relevant data based on the postal code. If that info doesn't exist, the page will just sit there until it finally times out leaving the user confused and bewildered.
To solve that dilemma, once I found the relevant syntax, I just qualified things by engaging that query only if there were some postal codes to query.
So, now for the first time in days, I'm actually able to look at some data on the page that, beforehand was simply timing out with no real explanation, at least as far as the user was concerned.
However...
As you can tell by the screenshot, while the page is firing, beneath the hood there's an error message that references "leaflet.js."
Upon closer inspection, "heatmap.js" is involved as well.
So, here's my dilemma...
Although there's only one row in my database at this point, there will most certainly be multiple rows, most of which will represent a complete array of information. In other words, they will have some postal codes.
But in those instances where you've got a renegade row with no postal codes, I want to prevent "heatmap" from firing.
Here's the twig file:
I'm looking for a "for" loop and I don't see one.
How can I evaluate each hypothetical row and prevent any attempt on the part of the system to try and plot that on the map?
BTW: I'm more than happy to provide as much code as you want or need in order to comment intelligently, but I thought I would start with the basics first - especially since both heatmap.js is a third party thing and I'm hoping there's some ninjas who've worked with it before that can point me in the right direction.
Thanks!
Here's what you're looking at:
This particular company doesn't have any address information .Within the code, there's a piece that's looking for some relevant data based on the postal code. If that info doesn't exist, the page will just sit there until it finally times out leaving the user confused and bewildered.
To solve that dilemma, once I found the relevant syntax, I just qualified things by engaging that query only if there were some postal codes to query.
So, now for the first time in days, I'm actually able to look at some data on the page that, beforehand was simply timing out with no real explanation, at least as far as the user was concerned.
However...
As you can tell by the screenshot, while the page is firing, beneath the hood there's an error message that references "leaflet.js."
Upon closer inspection, "heatmap.js" is involved as well.
So, here's my dilemma...
Although there's only one row in my database at this point, there will most certainly be multiple rows, most of which will represent a complete array of information. In other words, they will have some postal codes.
But in those instances where you've got a renegade row with no postal codes, I want to prevent "heatmap" from firing.
Here's the twig file:
<table id="main-dt" class="table custom make-datatable table-bordered table-striped dataTable no-footer" data-route="/companies/datatable" data-layout="tlipr" data-callback="initHeatMap();">
<thead>
<tr>
<th scope="col" data-field=":checkbox" data-searchable="0" data-sortable="0">
<div class="pretty p-default">
<input type="checkbox" class="table-all" />
<div class="state p-primary">
<label>All</label>
</div>
</div>
</th>
<th scope="col" data-field="name" data-searchable="0" data-sortable="1">Company</th>
<th scope="col" data-field="owner" data-searchable="0" data-sortable="1">Lead Owner</th>
<th scope="col" data-field="contacts" data-searchable="0" data-sortable="1">Contacts</th>
<th scope="col" data-field="addresses" data-searchable="0" data-sortable="1">Location</th>
<th scope="col" data-field="meta.ftes" data-searchable="0" data-sortable="1">FTE's</th>
<th scope="col" data-field="meta.premium" data-searchable="0" data-sortable="1">Premium</th>
<!-- th scope="col" data-field=":actions"> </th -->
</tr>
</thead>
<tbody></tbody>
</table>
I'm looking for a "for" loop and I don't see one.
How can I evaluate each hypothetical row and prevent any attempt on the part of the system to try and plot that on the map?
BTW: I'm more than happy to provide as much code as you want or need in order to comment intelligently, but I thought I would start with the basics first - especially since both heatmap.js is a third party thing and I'm hoping there's some ninjas who've worked with it before that can point me in the right direction.
Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
leak...
The problem with the app is that the user can add a company without adding the address in that the app assumes the user is going to add some contacts and it's only THEN that at any address data is being inputted.
I've alerted my boss and we're going to pause at this point and take an inventory if we don't want to go back and make that a required field.
In the interim, let me award some points and I appreciate your feedback!
The problem with the app is that the user can add a company without adding the address in that the app assumes the user is going to add some contacts and it's only THEN that at any address data is being inputted.
I've alerted my boss and we're going to pause at this point and take an inventory if we don't want to go back and make that a required field.
In the interim, let me award some points and I appreciate your feedback!
ASKER
Sorry if I was vague, let me see if I can't better qualify my dilemma.
And while some of this may be superfluous, it's still a health exercise on my part to review the flow / logic of the code.
The route is "/companies." You've got a bunch of functionality that sets up the architecture of the page and then sends all of that to "companies.html.twig."
Part of that "twig" file, includes a section where you have a table that's defined like this:
Open in new window
So, the content is coming from yet another route: "companies/datatable."
That route looks like this:
Open in new window
When you head out to the "company" service to view the "datatable" method, you see this:
Open in new window
Look at line #39. That was my most recent "victory" because, in this instance, I've got a flawed row in that there isn't any "address" information. In that case, you've got a problem in that the page doesn't list anything. It just presents a "processing" graphic before it times out.
With that IF clause, the user is now able to see the information they're expecting, even if there isn't any postal code etc.
But that doesn't change the fact that the system still expects some kind of address data and rightfully so. But until that particular company is properly edited, the system is still attempting to retrieve geographical information and...
I can't see how it's doing that.
THAT is my question.
From what I can gather, the above code is passing an array into the table div.
Fine.
But how can I intercept that information in a way where, should there be any companies that don't have address data, the system isn't going to try and retrieve any "map" data?
I did see this in the "company.js" service file (line #1124):
Open in new window
That looks pretty close, but I can't see how that might be connected.
So...
How can I qualify the data being assembled and whisked out the door by "datatables.js" in a way where, should there be an absence of address data, the system isn't making an attempt to retrieve geographical / map information?