in gridview the datatable datas are not binding - mysql

I have an issue in displaying the mysql data in a gridview. Am using Angular 4, to bind the data and show in a gridview.
I can bind the grid, but data are not displaying in the grid and there is no error in the console too. Even i am getting the response in console.
this is my html code for gridview:
<sa-widgets-grid>
<!-- row -->
<div class="row">
<!-- NEW WIDGET START -->
<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<!-- Widget ID (each widget will need unique ID)-->
<sa-widget>
<!-- widget options:
usage: <sa-widget id="wid-id-0" [editbutton]="false">
[colorbutton]="false"
[editbutton]="false"
[togglebutton]="false"
[deletebutton]="false"
[fullscreenbutton]="false"
[custombutton]="false"
[collapsed]="true"
[sortable]="false"
-->
<header>
<span class="widget-icon"></span>
<h2>Add Broadcaster </h2>
<div class="widget-toolbar">
<!--<button class="btn"><span class=""><i class="fa fa-plus-square"></i> </span><span>Import</span></button>-->
<button class="btn"><span class=""><i class="fa fa-plus-square"></i> </span><span>Add New</span></button>
</div>
</header>
<!-- widget div-->
<div>
<!-- widget content -->
<div class="widget-body">
<!-- this is what the user will see -->
<div class="widget-body no-padding">
<sa-datatable [options]="{
data: broacasterall,
columns: [
{data:'id'},
{data:'broadcaster_name'},
{data:'broadcaster_channel_name'},
{data:'broadcaster_email'},
{data:'w_application_name'},
{data:'state_code'}
],
buttons: [
'colvis'
]
}" tableClass="table table-striped table-bordered table-hover">
<thead>
<tr>
<th data-class="expand">Id</th>
<th data-class="expand">Broadcaster Name</th>
<th data-class="expand">Channel Name</th>
<th data-class="expand">Category Name</th>
<th data-class="expand">Email</th>
<th data-class="expand">Application Name</th>
<th data-class="expand">State,City</th>
<th data-class="expand">Video URL</th>
<!-- <th data-class="expand">YouTube Key</th>
<th data-class="expand">FaceBook Key</th>
<th data-class="expand">Haappyapp Key</th> -->
</tr>
</thead>
</sa-datatable>
</div>
</div>
<!-- end widget content -->
</div>
<!-- end widget div -->
</sa-widget>
this is my component.ts file:
in this code i call the broadcaster response and am getting the response in the console also .
here also there is no issues.when i debug the code am getting the data in the grid perfectly,however in localhost it's not binding.
getBroadcasterAllGrid()
{
this.broadcasterService.getAllBroadcasters()
.subscribe(
broadcasterResponse=>{
this.broacasterall=broadcasterResponse;
}),
error => this.errorMessage = <any>error;
};

Related

HTML Table wrap col data to fit to the view

Have a question about the HTML view related to the table.
In my HTML view, I have a table.
This is worked in a responsive way when changing the view.
Here I want to change the view that the responsive view comes with a scroll bar.
I want to change it to fit all columns to the view and wrap the column contents.
Any suggestions to do it?
<div class="col-md-12 col-sm-12 grid-margin stretch-card">
<div class="card shadow-card-l">
<div class="card-body">
<center><h4 class="card-title">Task Related Documents</h4></center>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Document Type</th>
<th>Document Note</th>
<th>File Name</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach (var item in Model.TaskFilesHistoryViewModel.OrderByDescending(x => x.Id))
{
<tr class="even pointer">
<td>#item.File_Type</td>
<td>#item.Note</td>
<td>#item.File_Name</td>
<td>
<a href="#Url.Action("DownloadTaskImage","Ajax", new { id = item.Id})" target="_blank" rel="publisher tag" class="btn btn-outline-info ti-import" />
<a href="#Url.Action("RetrieveTaskImage","Ajax", new { id = item.Id})" target="_blank" rel="publisher tag" class="btn btn-outline-success fa ti-eye" />
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>

how to display a blob file (image) from mysql using laravel

how to get the blob file (photo) that has already existed from MySQL using laravel, I am creating contact detail for the employee and it needs a photo and some of those employees don't have a picture in the database. beginners here. :)
this my controller
public function index()
{
$user = DB::table("user_basic")
->leftjoin("user_status","user_status.status_id" , "=" , "user_basic.user_id")
->leftjoin("user_employment","user_employment.emp_id" , "=" , "user_basic.user_id")
->leftjoin("user_photo","user_photo.photo_id" , "=" , "user_basic.user_id")
->select("user_status.*", "user_basic.*" , "user_employment.*","user_photo.*" )
->get();
if (request()->filled('status') && request('status') !== null) {
$user = $user->where('status_xtitle', request()->status);
}
$datatables = datatables::of($user);
return view("pages.Directory.index")->with("user",$user);
}
this is the index.blade where I will put the photo
</div>
<div class="row ">
<div class="col-12">
<div class="card-body">
<table class="table table-hover table-fw-widget " id="table4">
<thead>
<tr>
<th scope="col">Employee's information</th>
<th scope="col">Contacts</th>
<th scope="col">Employment</th>
</tr>
</thead>
<tbody>
#foreach ($user as $user)
<tr>
<td scope="row">
<div class="d-flex align-items-center">
<img src="" alt="">
<div>
<P><h6>
<?php
$arr = array($user->user_xfirstname,
$user->user_xmiddlename,
$user->user_xlastname);
echo join(" ",$arr);
?>
</h6></P>
<p id = "status"><small class= "text-muted">{{$user->status_xtitle}}</small> </p>
</div>
</div>
</td>
<td></td>
<td></td>
<td></td>
</tr>
#endforeach
</tbody>
</table>
</div>
</div>
<div class="col-1"></div>
</div>
</form>

Angular ExpressionChangedAfterItHasBeenCheckedError while using random numbers in progress bar

I get this ExpressionChangedAfterItHasBeenCheckedError when i am using random numbers progress bar in my html grid table.It says "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: some value. Current value: some value.". Someone please help me with the issue.
<nav class="navbar navbar-expand-sm bg-primary navbar-dark">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" routerLinkActive="active">
<button class="btn btn-primary" (click)="goToAddUser()">Add User</button>
</a>
</li>
</ul>
</nav>
<div class="panel panel-primary">
<div class="panel-heading">
<h2>User List</h2>
</div>
<div class="panel-body">
<table class="table table-striped">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>Actions</th>
<th>Progress</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let user of users | async">
<td>{{user.firstname}}</td>
<td>{{user.lastname}}</td>
<td>{{user.email}}</td>
<td>
<button (click)="goToEditUser(user.id)" class="btn btn-info">Update</button>
<button (click)="deleteUser(user.id)" class="btn btn-danger" style="margin-left: 10px">Delete</button>
<button (click)="goToViewUser(user.id)" class="btn btn-info" style="margin-left: 10px">Details</button>
</td>
<td>
<mat-progress-bar [value]="number" style="margin-right: 300px"></mat-progress-bar>
{{ number }}%
</td>
</tr>
</tbody>
</table>
</div>
</div>
The getRandomNumber() return value changes after angular change detection already checked its value. To understand the error better, read this article:
https://hackernoon.com/everything-you-need-to-know-about-the-expressionchangedafterithasbeencheckederror-error-e3fd9ce7dbb4
Here's one solution, make a class field called randomNumber and assign it to the value of getRandomNubmer().
class YourComponentClass { randomNumber : number = this.getRandomNumber(); ... }
In Html
<td> <mat-progress-bar [value]="randomNumber" style="margin-right: 300px">
</mat-progress-bar> {{ randomNumber }} </td>
if you want to change your randomNumber just create a click event handler to reassign randomNumber to getRandomNumber() method
You need to manually check for changes.
// Import
import { Component, OnInit, ChangeDetectorRef } from '#angular/core';
// Inject
constructor(private cd: ChangeDetectorRef)
// Call after making changes in component
someMethod() {
this.cd.detectChanges();
}

Angular export html

Whats up! I have a question - maybe banal, maybe not. I need to remove the HTML code to a file after generating it in the component. And everything would be cool, if not for the fact that if I do it
document.getElementById ('summary').outerHTML
or
this.summaryReport.nativeElement.innerHTML
I`ve
#ViewChild('summaryReport') summaryReport: ElementRef;
html:
<div #summaryReport id="summary" class="summary">
<div class="row border border-secondary">
<div class="col-md">
<h2> Podsumowanie sprzedaży biletów </h2>
</div>
</div>
<div class="row">
<ng-container *ngFor="let d of sortedData |keyvalue">
<div class="row">{{d.key}}</div>
<div class="col-md">
<table class="table">
<thead>
<th>{{'Ticket name'|translate}}</th>
<th>{{'Price'|translate }}</th>
<th>{{'Quantity'|translate}}</th>
</thead>
<tbody>
<tr *ngFor="let el of d.value">
<td>{{el.ticketName}}</td>
<td>{{el.price / 100}}</td>
<td>{{el.quantity}}</td>
</tr>
</tbody>
</table>
</div>
</ng-container>
</div>
</div>
</div>
in the verse I get 'bindings = {}' in place of ngFor.
Can anyone tell me what I do not understand?: D
I`ve answer.
Time....
I'm trying to generate a variable too quickly. After added another method to send html , work fine

Angular CLI won't show CSS

I use angular cli 1.4.3, node 6.11.3, npm 5.4.2, I want to read the records by using angular2. The output at localhost should be like this:
but the output that I get is like this:
here the html code:
<div class="row m-b-18px">
<div class="col-md-12">
<!-- button to create new product -->
<a (click)="createProduct()" class='btn btn-primary pull-right'>
<span class='glyphicon glyphicon-plus'></span> Create Product
</a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<!-- HTML table for our list of product records -->
<table class='table table-hover table-responsive table-bordered'>
<tr>
<th>Product</th>
<th>Price</th>
<th>Description</th>
<th>Category</th>
<th>Actions</th>
</tr>
<!-- Use *ngFor directive to loop throught our list of products. -->
<tr *ngFor="let product of products">
<td>{{product.name}}</td>
<td>{{product.price}}</td>
<td>{{product.description}}</td>
<td>{{product.category_name}}</td>
<td>
<!-- read one product button -->
<a (click)="readOneProduct(product.id)" class='btn btn-
primary m-r-5px'>
<span class='glyphicon glyphicon-eye-open'></span> Read
</a>
<!-- edit product button -->
<a (click)="updateProduct(product.id)" class='btn btn-info
m-r-5px'>
<span class='glyphicon glyphicon-edit'></span> Edit
</a>
<!-- delete product button -->
<a (click)="deleteProduct(product.id)" class='btn btn-danger
m-r-5px'>
<span class='glyphicon glyphicon-remove'></span> Delete
</a>
</td>
</tr>
</table>
</div>
</div>
Here the css code:
.m-b-18px{ margin-bottom: 18px; }
.m-r-5px{ margin-right: 5px; }
.w-40-pct{ width: 40%; }
.text-align-center{ text-align: center; }
Thank you
Looks like you do not include Bootstrap in your project. First, install it:
npm install --save bootstrap
Then go to angular-cli.json file, find styles properties and add "../node_modules/bootstrap/dist/css/bootstrap.min.css" so it looks like this:
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
Are you use the View encapsulation in the component?