Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flex grid not working for p-col-# primeng Angular 5

i am using primeNG for angular

https://www.primefaces.org/primeng/#/flexgrid

when i am trying this

<div class="p-grid">
<div class="p-col-6">
<div class="box">6 </div>
</div>
<div class="p-col-6">
<div class="box">6 </div>
</div>

</div>

the boxs are on top of each other and not next to each other i run

npm install primeflex --save

and added

"node_modules/primeflex/primeflex.css"

to angular.json

seems to be some thing related to the primeflex.css

the p-col class is working fine but the p-col-# (p-col-1 , p-col-2 etc ) are not working as excpected

this is the values for the p-col

-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
-ms-flex-preferred-size: 0;
flex-basis: 0;
padding: 0.5em;

this is the values for the p-col-#

-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
padding: 0.5em;

if for exmample i change the padding of the p-col-# to 0 then it is working but i don't have padding.. (i tried to change the p-col-# to the same values as the p-col and it is not working )

any ideas ?

Thanks Rahav

like image 956
RMagen Avatar asked Sep 13 '18 12:09

RMagen


2 Answers

use "grid" instead of "p-grid", there is class name change in lib files.

like image 167
Roshan Singh Avatar answered Nov 01 '22 02:11

Roshan Singh


It is work in my Angular6 project.

  1. install PrimeNG and PrimeFlex

    npm install primeng --save
    npm install primeflex --save
    
  2. add style to angular.json

    "./node_modules/primeng/resources/primeng.css",
    "./node_modules/primeflex/primeflex.css"
    

app.component.html

<div class="p-grid">
    <div class="p-col">1</div>
    <div class="p-col">2</div>
    <div class="p-col">3</div>
</div>
like image 34
Sato Avatar answered Nov 01 '22 00:11

Sato