Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog Framework: auto width ignored #2831

Closed
culjar opened this issue Oct 18, 2017 · 5 comments · Fixed by #7456
Closed

Dialog Framework: auto width ignored #2831

culjar opened this issue Oct 18, 2017 · 5 comments · Fixed by #7456
Assignees
Labels
documentation Documentation needs updating
Milestone

Comments

@culjar
Copy link

culjar commented Oct 18, 2017

It's not possible to auto adjust the width to fit content of a Dialog Framework.

When I put the value of parameter "contentWidth" as "auto" it doesn't change and it is always 640, because this is the default value of property 'contentWidth'. In fact, inspecting the page at runtime it puts the iframe width value as "auto" literally, instead of translating it to the corresponding calculated value.

1) Environment

  • PrimeFaces version: 6.1.7
  • It does not work on the newest sources in GitHub
  • Application server + version: Tomcat 8.0.27
  • Affected browsers: All

2) Expected behavior

Auto adjust the width to fit content of a Dialog Framework by setting "auto" value to "contentWidth" parameter.

3) Actual behavior

The "auto" value to "contentWidth" parameter is ignored.

4) Steps to reproduce

options.put("contentWidth", "auto");

5) Sample XHTML

<h:form> <p:commandButton value="Options" icon="ui-icon-extlink" actionListener="#{dfView.viewCarsCustomized}" /> </h:form>

6) Sample bean

package org.primefaces.showcase.view.df;
 
import java.util.HashMap;
import java.util.Map;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import org.primefaces.context.RequestContext;
import org.primefaces.event.SelectEvent;
import org.primefaces.showcase.domain.Car;
 
@ManagedBean(name = "dfView")
public class DFView {
     
     public void viewCarsCustomized() {
        Map<String,Object> options = new HashMap<String, Object>();
        options.put("modal", true);
        options.put("contentWidth", "auto");        
         
        RequestContext.getCurrentInstance().openDialog("viewCars", options, null);
    }
     
    public void chooseCar() {
        RequestContext.getCurrentInstance().openDialog("selectCar");
    }
     
    public void onCarChosen(SelectEvent event) {
        Car car = (Car) event.getObject();
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Car Selected", "Id:" + car.getId());
         
        FacesContext.getCurrentInstance().addMessage(null, message);
    }
     
    public void showMessage() {
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "What we do in life", "Echoes in eternity.");
         
        RequestContext.getCurrentInstance().showMessageInDialog(message);
    }
}
@tandraschko tandraschko added the enhancement Additional functionality to current component label Oct 18, 2017
@culjar
Copy link
Author

culjar commented Oct 18, 2017

I have created a PR #2834 to fix this issue.

@github-actions
Copy link

This issue is marked as stale because there was no activity on it for the last 2 years. Remove stale label or comment or this will be closed in 30 days

@github-actions github-actions bot added Stale Stale issue untouched for 2 years and removed Stale Stale issue untouched for 2 years labels Feb 12, 2021
@melloware
Copy link
Member

The crux of this issue is because its an IFrame when using the Dialog Framework there is no way to set auto width.

@tandraschko
Copy link
Member

@melloware so lets close it and add a hint to the docs?

@melloware
Copy link
Member

That is a great idea. I will update the docs and close this ticket once i have updated.

melloware added a commit to melloware/primefaces that referenced this issue Jun 23, 2021
@melloware melloware added documentation Documentation needs updating and removed enhancement Additional functionality to current component labels Jun 23, 2021
@melloware melloware self-assigned this Jun 23, 2021
@melloware melloware added this to the 11.0.0 milestone Jun 23, 2021
@melloware melloware linked a pull request Jun 23, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation needs updating
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants