0

I am getting a unknown property error, when using the var from data table in a html-data-id attribute, it is working in apex attributes perfect. I can't figure out how to make it work for html-data-id attribute.

                <apex:dataTable value="{!flatProductlineItems}" var="lineItem">
                    <apex:column headerValue="{!$ObjectType.Opportunity_Line_Item__c.fields.Category__c.Label}" styleClass="{!if(lineItem.showError=true,'ErrorInRed','')}">
                        <apex:outputText value="{!lineItem.product.Category__c}" rendered="{!IF(lineItem.lastRecord, false, true)}" />
                    </apex:column>
                    <apex:column headerValue="{!$ObjectType.Opportunity_Line_Item__c.fields.District__c.Label}" styleClass="{!if(lineItem.showError=true,'ErrorInRed','')}">
                        <apex:outputText value="{!lineItem.product.District__c}" rendered="{!IF(lineItem.lastRecord, false, true)}" />
                    </apex:column>
                    <apex:column headerValue="{!$ObjectType.Opportunity_Line_Item__c.fields.Start_Date__c.Label}" styleClass="{!if(lineItem.showError=true,'ErrorInRed','')}">
                        <apex:inputField value="{!lineItem.product.Start_Date__c}" rendered="{!IF(lineItem.lastRecord == false, true, false)}"/>
                    </apex:column>
                    <apex:column headerValue="{!$ObjectType.Opportunity_Line_Item__c.fields.Total_Amount__c.label}" styleClass="{!if(lineItem.showError=true,'ErrorInRed','')}">
                        <apex:inputText html-data-id="{!lineItem.position}" style="text-align:right;" value="{!lineItem.product.Total_Amount__c}" rendered="{!IF(lineItem.lastRecord == false, true, false)}" />
                        <apex:inputText value="{!lineItem.subTotalAmount}" style="text-align:right;" rendered="{!lineItem.lastRecord}" html-readonly="true" />
                    </apex:column>
                    <apex:column styleClass="{!if(lineItem.showError=true,'ErrorInRed','')}">.
                        <apex:commandButton value="-" action="{!removeFlatProduct}" status="LoadingSpinner" rendered="{!IF(lineItem.lastRecord == false, true, false)}" reRender="flatPanelContainer,errorPanel" style="text-align:center;width:20px;">
                            <apex:param name="flatProductToRemove" value="{!lineItem.position}" assignTo="{!flatProductToRemove}" />
                        </apex:commandButton>
                    </apex:column>
                </apex:dataTable>

I am getting an error that the property lineItem is not found in the controller , however it should use the property from var attribute. Here is the flatProductLineItems variable in the controller:

   public List<LineItemWrapper> flatProductLineItems { get {
        if(flatProductLineItems == null) {
            flatProductLineItems = new List<LineItemWrapper>();
        }
        return flatProductLineItems;
    } set; }

If i remove the attribute html-data-id from the apex:inputText everything is compiling and working ok.

  • Can you please post the flatProductlineItems's class as well – Vijay Ganji Jan 31 at 9:34
0

This is what I tried and it's working for me. Make sure you put the datatable tags inside the apex:form tag.

    <apex:page controller="CONTROLLER">
     <apex:form>
      <apex:dataTable value="{!LIST}" var="VAR">
        <apex:column headerValue="Name">
            <apex:inputText html-data-id="{!VAR.NameString}" value=" 
                                                            {!VAR.NameString}"/>
        </apex:column>
     </apex:dataTable>
  </apex:form>
</apex:page>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.