How do I enable Grid layout at primeng dataview - html

I'm trying to use dataview component from primeng, I've imported the module successfully, installed primeflex and read the documentation but when i try to use the grid layout it doesn't work and only shows the items in a vertical line,
I've tried to solve the problem using chrome inspect tool and tried to update the styles from the component CSS file but it didn't work also,
I've checked whether this CSS file is accessible or not and it has no problem at this point the problem is that when i try to give the .grid class a flex display for example it doesn't affect the view at all
this is the html code
<div class="container" *ngIf="topProducts != null">
<div>
<p-dataView #dv [value]="topProducts" layout="grid" class="p-dataview">
<ng-template let-prod pTemplate="gridItem">
<div class="col-12 md:col-4" style="width: fit-content;">
<app-product [product]="prod"></app-product>
</div>
</ng-template>
</p-dataView>
</div>
</div>
I think the problem related to primeflex ,when I installed it using npm i primflex it was installed successfully but didn't affect the dataview module at all
I'm using primeng 15.2.0
and primeflex 3.3.0

Related

Overlapping "No files chosen" label in bootstrap form control

We recently switched to webpack for our assets (js, scss, ...) and everything went fine so far, except a small bug where the input label behind the file-selector-button overflows with is neighbour as you can see in these examples below. Even with the default bootstrap styles (no additional whatsoever) we still encounter this bug.
Basic webpack application configuration:
import "bootstrap/scss/bootstrap.scss";
import "bootstrap-icons/font/bootstrap-icons.css"
// [...]
import "bootstrap";
Snippet of the first example:
<div class="row pb-3">
<div class="col">
<input class="form-control" type="file" name="uploadFile" id="uploadFile" required>
<div class="invalid-feedback">
Please select a file
</div>
</div>
</div>
The second example is from Bootstrap Docs
Even the inspector from e.g. Google Chrome does not help either and by now i could not find any solutions to fix this issue.
I am using Bootstrap 5.2.0 (tested 5.2.2, 5.1.x, ... with same results), no additional changes made to bootstrap itself.
Okay, looks like it has something to do with postcss-loader. Arguments like margin-inline-starts will be "removed" from built version (other Post: How to prevent 'postcss-preset-env' from removing CSS logical properties?)
The suggested solution does not work but removing postcss-loader at all is a possible temporary solution right now... but i will look forward to fix it and keep using postcss-loader

How to create a navbar similar to the Angular Material 2 website?

I am trying to learn Material in combinaton with Angular so that I can later apply the Material Design pattern to my applications. After browsing around I found Material2 for Angular and installed it on my machine through NPM. The website describes all the components it has and I first tried to start with the navigation components. After fiddling around a bit I found out that the components were not responsive. After some research I found out that flex layout could make the components work in combination with Material2. One thing I noticed on the Material2 website was that when I narrow the browser down to mobile device sizes, it would change the navbar (which has a few buttons) to this:
I marked the three buttons with a red box (Components, CDK, Guides). This is what I want to recreate, but as far as I know, there are no navbar components for Material2. Altough the navbar has Material2 buttons in it:
I was wondering how they made this, what do I need to have in order to do this? Can it be build in Material2 or should I use something else?
Thanks in advance.
FlexLayout offers a Responsive API, which lets you define different layout properties based on the media query, e.g.:
<div fxLayout='column' class="zero">
<div fxFlex="33" [fxFlex.md]="box1Width" class="one" ></div>
<div fxFlex="33" [fxLayout]="direction" fxLayout.md="row" class="two">
<div fxFlex="22" fxFlex.md="10px" fxHide.lg class="two_one"></div>
<div fxFlex="205px" fxFlex.md="65" class="two_two"></div>
<div fxFlex="30px" fxFlex.md="25" fxShow [fxHide.md]="hideBox" class="two_three"></div>
</div>
<div fxFlex class="three"></div>
</div>
Install FlexLayout through npm in your project.
Steps to install FlexLayout:
npm install #angular/flex-layout –save
or with yarn
yarn add #angular/flex-layout
And if you do not want to use FlexLayout, you can use Bootstrap4 & material design, refer 'https://mdbootstrap.com/docs/angular/navigation/navbar/'

Angular Flex-Layout Grid Line Break with fxLayoutWrap

I used to be able to create a grid with line break in angular flex-layout using fxLayoutWrap.
Seems that it doesn't work anymore. Whatever number I put in fxFlex, the div doesn't go to the next line. I saw the example Angular flex-layout with ngFor, but I can't make it work on my side.
<div fxLayout="row" fxLayout.xs="column" fxLayoutWrap="wrap">
<div
fxFlex.gt-xs="50%"
[fxFlex.gt-md]="regularDistribution"
*ngFor="let country of countries">{{ country }}
</div>
</div>
I downgraded "#angular/flex-layout": "2.0.0-beta.10-4905443",
in package.json and it's working again...

How to enable bootstrap 4 flex?

So I'm on this page:
http://v4-alpha.getbootstrap.com/getting-started/flexbox/
I am trying to enable bootstrap flex so I can use it in my application. Down at the bottom it tells you to head to a download page and installed the compiled CSS version with flex box enabled. So I uninstalled bootstrap from my application and ran this line in the package manager console:
PM> Install-Package bootstrap -Pre
This installed the _variables.scss file with enableFlex set as true.
It also downloaded bootstraps.css/min files and also the appropriate bootstrap JS files. I also installed tether via NuGet because bootstrap required this.
I copied this code from the bootstrap website:
<div class="container">
<div class="row">
<div class="col-xs">
1 of 2
</div>
<div class="col-xs">
1 of 2
</div>
</div>
<div class="row">
<div class="col-xs">
1 of 3
</div>
<div class="col-xs">
1 of 3
</div>
<div class="col-xs">
1 of 3
</div>
</div>
</div>
Which is meant to use flex box to display some divs. However, when running the application they do not show how their supposed to show. Follow this link and scroll down to see what it's supposed to look like:
http://v4-alpha.getbootstrap.com/layout/flexbox-grid/#auto-layout-columns
I have no console errors, I can't see what I'm doing wrong. I believe it may be an issue with the bootstrap download as the css file downloaded does not have the .col-xs class. Only the col-xs-1 and up classes.
Does anyone know how to enable the flex features in bootstrap 4?
Right well I managed to get the thing working. I do believe that there is an issue with the bootstrap download or at the very least the wording on the website.
The way I managed to get it to work was like so:
Run this in the NuGet Package Manager Console
Install-Package bootstrap.sass -Pre
Install Ruby
Install sass via Ruby CMD
I put a watch on the whole folder of the bootstrap scss files
This then generated me all the css files I needed. I then used the bootstrap-flex.css file on my view and it worked.
Why it says to download the compiled flex css on the page I don't know.

Bootstrap 3.0 Text Disappears on refresh

I'm trying to use Bootstrap 3.0 as a template to create a website. The issue I'm having is that when you refresh the page all of the text disappears. It does not do it every time but 8/10 times it does. Here is the demo I have put on my website for you guys to check it out. http://dwayned.co/JSwebsite/
Please let me know if you have any questions or need to see any code.
Your HTML is quite messed up. Bootstrap structure should be like this...
<div class="container">
<div class="row">
<div class="col-xs-12">
YOUR CONTENT HERE
</div>
</div>
</div>
In the above example I've used one col-xs-12 class but you can use any combination of cols here as long as they add up to 12. See more on the Bootstrap grid system here in their docs: http://getbootstrap.com/css/#grid
I also notice in your code you are using a span12 class but this is from Bootstrap v2 and not the new v3 which uses the col classes I've outlined in my example above.
I found this existing thread that has a couple different answers referring to your issue. https://stackoverflow.com/questions/21984543/google-chrome-bug-website-not-displaying-text