使用APEX:重复Apex:outputpanel

发布于 2025-01-26 14:04:07 字数 2175 浏览 3 评论 0原文

我有这个VF,该VF在第一个OutputPanel内部有一个按钮,该按钮就像是要显示的第二个输出面板的网关,

<apex:page standardController="SObject" contentType = "{!IF(!showForm, 'text/html', 'application/vnd.ms-excel#TestFile123.csv')}" showHeader="true" sidebar="true" extensions="Class123" lightningStylesheets="true">
    <apex:outputPanel layout="none" rendered="{!!showForm}"> <!-- Added Shifting VF Page | if showForm is FALSE-->
        <apex:form >
            <apex:commandButton action="{!activator}" value="Activator" id="xoxo"/>
        </apex:form>
    </apex:outputPanel>

    <apex:outputPanel layout="none" rendered="{!showForm}"> <!-- if showForm is TRUE-->
        {!header}
        <apex:repeat value="{!tXoxo}" var="TN" >
            {!TN.A},{!TN.B},{!TN.C},""
        </apex:repeat> 
    </apex:outputPanel>
</apex:page>

我可以使用CSV文件的提取。但是,该文件仅具有标头 /不显示{!tn.a}的任何值,{!tn.b},{!tn.c},“” APEX:

然后在控制器类中重复:

//Constructor 2.0
    public Class123 (ApexPages.StandardController controller){    
    
        this.controller = controller;
        this.csSO = (SObject1)controller.getRecord();
        
        if(csSO != null){
                 csSO = [SELECT Id, 
                                H, 
                                c, N, 
                                D, E 
                            FROM SObject1 WHERE Id =: csSO.id];
            system.debug(csSO.Name);
            cTQwNs = [SELECT Id, 
                            A,
                            B,
                            C,
                            D
                        FROM SObject2 WHERE S =: csSO.id];
        }
    }

    public void activator() {//sets the showForm variable to true
        showForm = true;
        tXoxo = populateTestClass();
        system.debug(tXoxo[0]);
    }

根据我的调试日志,我似乎找不到CSSO.NAME值。所以我猜想“也许控制器根本没有传递任何东西?” 因为在classs123之后,在下面有这

public <dataType> populateTestClass() {}

是txoxo所调用的,在Apex中被调用:在VF中重复,但没有获得任何值。 我传递控制器类内的值的方法非常直接,因此我找不到传递零值的其他可能原因。

任何有想法的人是否真的有实例,控制器不通过任何东西,以及如何解决此类问题?

I have this VF that has a button inside the first outputPanel which acts like a gateway for the 2nd output panel to be shown

<apex:page standardController="SObject" contentType = "{!IF(!showForm, 'text/html', 'application/vnd.ms-excel#TestFile123.csv')}" showHeader="true" sidebar="true" extensions="Class123" lightningStylesheets="true">
    <apex:outputPanel layout="none" rendered="{!!showForm}"> <!-- Added Shifting VF Page | if showForm is FALSE-->
        <apex:form >
            <apex:commandButton action="{!activator}" value="Activator" id="xoxo"/>
        </apex:form>
    </apex:outputPanel>

    <apex:outputPanel layout="none" rendered="{!showForm}"> <!-- if showForm is TRUE-->
        {!header}
        <apex:repeat value="{!tXoxo}" var="TN" >
            {!TN.A},{!TN.B},{!TN.C},""
        </apex:repeat> 
    </apex:outputPanel>
</apex:page>

I'm able to have an extract of CSV file. However, the file only has the header / not showing any of the values of {!TN.A},{!TN.B},{!TN.C},"" which is inside the apex:repeat

THEN in the controller class:

//Constructor 2.0
    public Class123 (ApexPages.StandardController controller){    
    
        this.controller = controller;
        this.csSO = (SObject1)controller.getRecord();
        
        if(csSO != null){
                 csSO = [SELECT Id, 
                                H, 
                                c, N, 
                                D, E 
                            FROM SObject1 WHERE Id =: csSO.id];
            system.debug(csSO.Name);
            cTQwNs = [SELECT Id, 
                            A,
                            B,
                            C,
                            D
                        FROM SObject2 WHERE S =: csSO.id];
        }
    }

    public void activator() {//sets the showForm variable to true
        showForm = true;
        tXoxo = populateTestClass();
        system.debug(tXoxo[0]);
    }

Based on my debug logs, i can't seem to find the csSO.Name value. So im guessing "maybe controller is not passing anything at all?"
Because after Classs123, there's this below it

public <dataType> populateTestClass() {}

which is what is being called by tXOxo and called inside the apex:repeat in the VF but it's not getting any value.
My approach in passing the values inside the controller class is very direct so I can't find other possible cause of having null value being passed.

Anyone who has an idea if there really are instances wherein controller doesn't pass anything, and how to solve such issue??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

留一抹残留的笑 2025-02-02 14:04:07

事实证明,如果它不是主要控制器,则无效。我使用的类是2ndary Controller类不起作用,因此根本没有设置任何值 - 因此无法传递任何值。

如果您在我做了另一个控制器类的地方做了我所做的事情,只需确保您将其传递到另一个参数。欢呼~~

Turns out it doesn't work if it's not the main controller. The class I was using as the 2ndary controller class was not working and therefore not setting any value at all -- therefore not able to pass any value.

If you did what I did wherein I made another controller class, just make sure you're passing into it a different parameter. Cheers~~

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文