Issue with DataView custom dataViewLayoutOptions
I'm submitting a ... (check one with "x")
[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Current behavior
if i create my own dataViewLayoutOptions components changing the layout property of
Expected behavior As the ddocumentation suggest i can create my own UI for layout options buttons and change layout by changing th layout property
Minimal reproduction of the problem with instructions
if i create my own dataViewLayoutOptions components changing the layout property of
What is the motivation / use case for changing the behavior? i want to hide few items in header if it is a grid and show them if it is a list. As i dont know which layout is shown i cant do this
Please tell us about your environment: Windows 10, Visual Studio, NPM, WebAPI
-
Angular version: 5.2.9
-
PrimeNG version: 5.2.3
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] All Browsers
-
Node (for AoT issues):
node --version= 6.0.102
You can know which is the current layout:
https://github.com/primefaces/primeng/blob/master/src/app/components/dataview/dataview.ts
@Input() layout: string = 'list';
The values are either list or grid. You could make it an *ngIf block, and check for the class used, they determine the class in the DataView template:
'ui-dataview-list': (layout === 'list'), 'ui-dataview-grid': (layout === 'grid')
if a $( ".ui-dataview-list" ) returns something, likely the list view is selected.
Or you can always implement your own local custom DataView.
Closing as per comment above.
good day, I was trying to make use of the dataviewlayoutoptions component in primeng I got the following errors
- Type 'string' is not assignable to type '"list" | "grid"'. [layout] = layout layout property was defined in my ts as layout: string = 'list'
- Can't bind to 'layout' since it isn't a known property of 'p-dataViewLayoutOptions'.
- If 'p-dataViewLayoutOptions' is an Angular component and it has 'layout' input, then verify that it is included in the '@Component.imports' of this component.
- If 'p-dataViewLayoutOptions' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Component.schemas' of this component to suppress this message.
- To allow any property add 'NO_ERRORS_SCHEMA' to the '@Component.schemas' of this component.
these are the two errors