amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Amp-List height set dynamically on page load.

Open gskaushal92 opened this issue 5 years ago • 5 comments

Description

Currently I have to give fixed height to the amp-list. But I want that list should get height based on the content loaded inside the list. I have a json data which gets validated on page load. There is a possibility that I may get empty array in that case list should take height as 0 on page load. And If I get data on page load, then it gets height based on the data loaded.

Reproduction Steps

  1. Get data from json on page load and bind it to the listt.
  2. If data returned is empty array then height should be 0.
  3. if I have data on page load then list should take content height.
  4. Please help to resolve this issue.

Relevant Logs

No response

Browser(s) Affected

No response

OS(s) Affected

No response

Device(s) Affected

No response

AMP Version Affected

No response

gskaushal92 avatar Jul 31 '21 11:07 gskaushal92

Anyone has any update on this issue?

gskaushal92 avatar Aug 02 '21 17:08 gskaushal92

Dupe of https://github.com/ampproject/amphtml/issues/26873

samouri avatar Aug 02 '21 19:08 samouri

do we having working example for this. because when I am setting layout ="container". I am getting following error : Experiment "amp-list-layout-container" is not turned on.​​​ and data is not loading.

gskaushal92 avatar Aug 03 '21 05:08 gskaushal92

@caroqliu I am getting the same error when I am trying to test https://github.com/ampproject/amphtml/blob/main/examples/amp-list-layout-container.amp.html this example on my local machine. Could you please let me know if this is possible or not?

gskaushal92 avatar Aug 03 '21 05:08 gskaushal92

@caroqliu I am getting the same error when I am trying to test https://github.com/ampproject/amphtml/blob/main/examples/amp-list-layout-container.amp.html this example on my local machine. Could you please let me know if this is possible or not?

As per the discussion in #26873, we will likely move to remove requirement of the experiment amp-list-layout-container to get the feature enabled by default. I'd recommend following that issue for updates.

In the mean time you have a few options:

  • enable the experiment for local development by calling AMP.toggleExperiment('amp-list-layout-container') in the console
  • enable the experiment for users by following the instructions at "Enable experimental features"
  • use the similar, more light-weight, and recently launched amp-render

caroqliu avatar Aug 03 '21 12:08 caroqliu