I'm working on a PHP/ Laravel application, and there is a form on one of the pages displaying a table showing information about various transactions made through the website.
One of the columns in the table is titled 'Contact', and displays the contact details for the person responsible for that transaction. Each cell in this column also displays an 'Edit' button, which will open a dialog that allows the user to add/ remove/ change the contact whose details will be displayed for this transaction.
Currently, when the user clicks the 'Edit' button and the dialog is displayed, that 'Edit' button icon changes to an 'X' to allow them to close the dialog, but the dialog itself is displayed slightly below this location on the page, so it seems a number of users are missing that this is how they would close the dialog.
I want to add an 'X' button to the dialog itself, to allow the users to close it by clicking that too.
The HTML displaying this table cell & dialog is:
<td data-heading="Provisional Contact" class="provContactCell table__priority-column" id="fixPayerName">
<i class="icon icon-pencil" [class.icon-close-selected]="payer.showProvContactSelector" (click)="toggleProvContactSelector(payer)">
</i>
...
<div class="provContactSelector" *ngIf="payer.showProvContactSelector">
<h3>Provisional Contacts & Managers</h3>
<button class="icon icon-close-selected" (click)="toggleProvContactSelector(groupPayer)"></button>
<p>Check/un-check which contacts should be provisional contacts and managers.</p>
<div class="provContacts">
...
</div>
</div>
</div>
</td>
I tried adding the button in just after the <h></h>
tags, but when I view the page, and open the dialog in the browser, the button is displayed below the dialog title. If I try putting the button inside the <h></h>
tags, I get errors in the console, and the page doesn't load correctly...
The console errors are:
vendor.bundle.js?ver=1486951446:54441 ERROR Error: Uncaught (in promise): Error: Loading chunk common failed.
Error: Loading chunk common failed. at HTMLScriptElement.onScriptComplete (inline.bundle.js?ver=1432283697:104) at HTMLScriptElement.wrapFn (polyfills.bundle.js?ver=450735834:6545) at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.bundle.js?ver=450735834:5800) at Object.onInvokeTask (vendor.bundle.js?ver=1486951446:57733) at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.bundle.js?ver=450735834:5799) at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.runTask (polyfills.bundle.js?ver=450735834:5567) at ZoneTask.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke]
How can I make the button be displayed in the top right corner of the dialog, rather than below the title? I tried putting the <h></h>
tags in a div, along with the button, to keep them separate from the rest of the dialog, but this also gave a number of console errors...
Edit
I've also just tried displayed the dialog title & the close button in a table, to see if that will get the layout right:
<div class="provContactSelector" *ngIf="payer.showProvContactSelector">
<table id="dialogTitle">
<tr>
<td>
<h3>Provisional Contacts & Managers</h3>
</td>
<td>
<button class="icon icon-close-selected" (click)="toggleProvContactSelector(false)"></button>
</td>
</tr>
</table>
...
</div>
but doing this just causes the Exit button to be displayed below the dialog title again... Anyone have any ideas?
Edit
So, I did what @Jonathan Hamal recommended in his comment, and changed the heading tag to:
<h3 style="display: inline-block">Provisional Contacts & Managers</h3><button type="button" (click)="toggleProvContactSelector(grouopPayer)"><img src="c:\Users\...\icon-close.png"></button>
and I can now see that the image is being displayed in the correct location in the dialog (next to the dialog heading). However, the image does not seem to be rendered correctly- instead of the actual image being displayed, it's just displaying a '.png' file icon.
Also, when I click on the 'Edit' icon in the contact cell, to open the dialog, the console is showing an error:
ERROR TypeError: Cannot read property 'showProvContactSelector' of undefined at Object.eval [as updateRenderer] (ProvisionalRemindersComponent.html:349)
The showProvContactSelector
variable is what's being given to the ngIf
in the <div>
declaration in which this <h></h>
tag is located.
Anyone have any suggestions on how to resolve this?
Edit
So, it seems that the reason the image I had added wasn't displaying properly was because it was located outside the project directory (even though I had specified the full file path). I changed it to use an image file from within the project directory:
<h3 style="display: inline-block">Provisional Contacts & Managers <i class="icon icon-close-selected" (click)="toggleProvContactSelector(groupPayers.selectedPayer)"></i></h3>
and can now see the image displayed properly. I also needed to add the style="display: inline-block"
attribute to the image tag in order to get it to display on the same line as the heading text.
, it is a block element and will not allow the button to sit next to it. Use `h3 { display: inline-block }` for your first version
– Jonathan Hamel Sep 20 '18 at 13:25Provisional Contacts & Managers
`, but that doesn't seem to have made a difference... – Noble-Surfer Sep 20 '18 at 14:00A
`. You can go around https://www.w3schools.com/html/html_styles.asp to get an introduction on html and css. Also, make sure your button in **not** in thetag, but right after since
– Jonathan Hamel Sep 20 '18 at 14:36Provisional Contacts & Managers
`, and when I now open the dialog, I can see that there is an image where I placed it, but that image isn't displayed properly- it displays an image file icon, rather than the image itself. I also get an error in the console when the dialog opens, saying `Cannot read property 'showProvTaxContactSelector' of undefined`... – Noble-Surfer Sep 21 '18 at 14:19