primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Issue with DataView custom dataViewLayoutOptions

Open ankitraonka opened this issue 8 years ago • 3 comments

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 doesnt change the layout but only changes the css class,

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 doesnt change the layout but only changes the css class, as we dont have access to DataView class funciton (changeLayout). How can i make my own grid and list icons and change the layout on selection of respective list or grid icons

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

ankitraonka avatar Apr 07 '18 05:04 ankitraonka

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.

jfuentesve avatar May 12 '18 00:05 jfuentesve

Closing as per comment above.

cagataycivici avatar Oct 23 '18 08:10 cagataycivici

good day, I was trying to make use of the dataviewlayoutoptions component in primeng I got the following errors

  1. Type 'string' is not assignable to type '"list" | "grid"'. [layout] = layout layout property was defined in my ts as layout: string = 'list'
  2. Can't bind to 'layout' since it isn't a known property of 'p-dataViewLayoutOptions'.
  3. 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.
  4. If 'p-dataViewLayoutOptions' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Component.schemas' of this component to suppress this message.
  5. To allow any property add 'NO_ERRORS_SCHEMA' to the '@Component.schemas' of this component.

these are the two errors

bennybillions avatar Jun 07 '24 18:06 bennybillions