小编NDe*_*per的帖子

可以'更新'属性同时更新两个组件吗?

我有个问题.是否可以一次更新两个组件?我正在尝试这样的代码:

<h:panelGroup id="pickList">
    <p:panel  rendered="#{customCalender.visible}" widgetVar="searchTableBox">

    //Some codes.....

        <p:commandButton value="Cancel" update="pickList" actionListener="#{customCalender.closeList}" style="background:#25A6E1;color:red;font-family:'Helvetica Neue',sans-serif;font-size:10px;border-radius:4px;" />
        <p:commandButton value="Save" update="custDataTablePanel" actionListener="#{customCalender.saveTargetList}" style="background:#25A6E1;color:red;font-family:'Helvetica Neue',sans-serif;font-size:10px;border-radius:4px;"/>
   </p:panel>
</h:panelGroup>
....
.....
<h:panelGroup  id="custDataTablePanel">
   <p:panel rendered="#{customCalender.dataTableVisible}">
..
..
   </p:panel>
</h:panelGroup>
Run Code Online (Sandbox Code Playgroud)

现在我希望当我点击Save它隐藏的按钮<h:panelGroup id="pickList">并显示时,<h:panelGroup id="custDataTablePanel">我有两个布尔值来控制它们的可见性.但我需要更新其中两个面板.我用update="custDataTablePanel"它做的一个显示按钮点击后的数据表.(在方法中saveTargetList我更新了custDataTablePanel真实的可见性.)但是无法设法隐藏面板pickList.

所以我在游荡是否有任何方法可以隐藏并在一键式按钮中显示这两个面板.请建议.

jsf primefaces

8
推荐指数
1
解决办法
1万
查看次数

无法读取未定义的属性'prepareStyles'

我试图Dialog通过点击按钮打开一个框.当我点击按钮时,Dialog首先没有打开,我收到错误:

未捕获的TypeError:无法读取未定义的属性'prepareStyles'.

这是我的组件的代码:

const muiThemebtn = getMuiTheme({
    palette: {
    alternateTextColor: darkBlack,
    primary1Color: grey100,
  }
})

export default class MyComponent extends React.Component {
  constructor (props) {
    super(props);
    this.state = {open: true};
    this.openModal = this.openModal.bind(this);
    this.closeModal = this.closeModal.bind(this);
  }


  openModal=()=>{ this.setState({open: true}); }

  closeModal=()=>{ this.setState({open: false}); }

  render () {

          const actions = [
            <FlatButton
              label="Cancel"
              primary={true}
              onTouchTap={this.handleClose}
            />,
            <FlatButton
              label="Submit"
              primary={true}
              keyboardFocused={true}
              onTouchTap={this.handleClose}
            />,
          ];
        return (
          <div>
            <MuiThemeProvider muiTheme={muiThemebtn}>
                <RaisedButton label={Lang.AddUser} 
                  onTouchTap={this.openModal}
                  primary={true}
                  display='none'
                  icon={<ContentAddBox color={darkBlack} …
Run Code Online (Sandbox Code Playgroud)

components dialog reactjs material-ui

7
推荐指数
2
解决办法
6484
查看次数

使用 axios.get 渲染 json 数据

我是 react.js 的新手,我试图在表中以 JSON 格式获取服务器端数据。所以我所做的是:

export default class TableUser extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
    table: [],
  }
}
componentDidMount(){
  axios.get('http://www.reddit.com/r/reactjs.json')
    .then((response)=>{
      const table = response.data.map(obj => obj.data);
        this.setState({ table });
      })
    .catch((err)=>{

    })
}
Run Code Online (Sandbox Code Playgroud)

我把它渲染成<div>这样:

render(){
    <div><p>{this.state.table.kind}</p></div>
}
Run Code Online (Sandbox Code Playgroud)

为什么我没有得到 的价值kind?请推荐!!

json reactjs axios

5
推荐指数
1
解决办法
5万
查看次数

p:列呈现属性似乎不适用于p:dataTable var

我写了一个代码:

<p:column headerText="Edit" width="40" rendered="#{(leaveDetails.strLeaveStatus == 'Canceled') or (leaveDetails.strLeaveStatus == 'Availed')}">
    <p:commandLink actionListener="#{userLeaveBean.editAppliedLeave}" title="Edit" disabled="true" process="@this" update="leaveDataTable" immediate="false">
        <h:graphicImage url="resources/images/edit.JPG"/>
            <f:attribute name="userId" value="#{employee.name}"/>
            <f:attribute name="editFirstHalf" value="#{leaveDetails.strStartTiming}"/>
            <f:attribute name="editSecondHalf" value="#{leaveDetails.strEndTiming}"/>
            <f:attribute name="editFrom" value="#{leaveDetails.dtLeaveFromDate}"/>
            <f:attribute name="editTo" value="#{leaveDetails.dtLeaveToDate}"/>
            <f:attribute name="leaveId" value="#{leaveDetails.strLeaveId}"/>
    </p:commandLink>
</p:column>
Run Code Online (Sandbox Code Playgroud)

但渲染的属性不适用于该条件.如何使用逻辑运算符使条件有效?使用PrimeFaces 3.4.2

datatable jsf primefaces tablecolumn conditional-rendering

4
推荐指数
2
解决办法
7817
查看次数

在<p:commandLink>中传递参数

嗨我有一个像这样的代码:

<p:commandLink value="#{user.strUserid}" action="test.xhtml?faces-redirect=true"/>
Run Code Online (Sandbox Code Playgroud)

如何将参数传递给test.xhtml以获取所述页面中的值?我尝试使用<f:param>tag.But可以获取test.xhtml页面中的值.请建议.

jsf primefaces

4
推荐指数
2
解决办法
2万
查看次数

PrimeFaces清除提交表单时的文本字段

我有一个注册表格的代码.<p:commandButton>.当我提交按钮时,有一些字段和类型为现在的提交按钮,它在表单下显示一个数据表,用于呈现输入字段的值.我想在表单提交后清除输入文本字段.但价值仍然存在.如何清除表单文本字段的值?

<p:panel header="Registration Form" closable="true" closeSpeed="100" toggleable="true" toggleSpeed="100" toggleOrientation="vertical">
            <h:panelGrid columns="2" cellpadding="5">
                <p:outputLabel value="*First Name"/>
                <p:inputText id="firstname" value="#{registrationDetails.firstName}" required="true" label="First Name" requiredMessage="First Name required!"/>

                <p:outputLabel value="*Last Name"/>
                <p:inputText id="lastname" value="#{registrationDetails.lastName}" required="true" label="Last Name" requiredMessage="Last Name required!"/>

                <p:outputLabel value="Location"/>
                <p:selectOneMenu id="location" value="#{registrationDetails.location}">
                    <f:selectItem itemLabel="Select Location" itemValue=""/>
                    <f:selectItems value="#{registrationDetails.locations}"/>
                </p:selectOneMenu>

                <p:outputLabel id="email" value="*Email"/>
                <p:inputText value="#{registrationDetails.email}" required="true" label="Email" requiredMessage="Email address required!"/>

                <p:outputLabel value="*Contact Number"/>
                <p:inputText id="contactNumber" value="#{registrationDetails.contactNumber}" autocomplete="false" maxlength="10" required="true" label="Contact Number" requiredMessage="Contact Number required!"/>

                <p:outputLabel value="Address"/>
                <p:inputTextarea value="#{registrationDetails.address}"/>
            </h:panelGrid>
<p:commandButton …
Run Code Online (Sandbox Code Playgroud)

primefaces jsf-2

3
推荐指数
1
解决办法
2万
查看次数