代码之家  ›  专栏  ›  技术社区  ›  jMarcel

如何添加JQPlot类来隐藏页面加载时的所有图表行?

  •  0
  • jMarcel  · 技术社区  · 7 年前

    see this example

    <h:body onload="HideSeries()" >
        <!-- [unrelevant code ommited] -->
    </h:body>
    
    <script>
        function HideSeries() {
            $('#chartsFormID\\:lineChartID').toggleClass('jqplot-series-hidden');
        }
    </script>
    

    我的index.xhtml文件:

    <h:form id="chartsFormID" >
        <p:accordionPanel multiple="false" dynamic="true" cache="true" >
            <p:tab title="myTab title">
                <p:chart type="line" id="lineChartID" model="#{bean.myChart}" />
            </p:tab>
        </p:accordionPanel>
    </h:form>
    

    An image for better understanding

    谁能帮帮我吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Javier    7 年前

    要将类添加到所有元素,请尝试以下操作:

    $('tr.jqplot-table-legend td').toggleClass('jqplot-series-hidden');
    

    $('tr.jqplot-table-legend td').trigger('click');