1

Apex code:

    List<order_batch__c> bcList = new List<order_batch__c>();
        bcList= [select Order_numbering__c,Or_clientpn__c,Or_customerid__c,Or_customer_PO_Number__c,Or_Nicomatic_p_n__c,Or_Quote_number__c,Quantity_Ordered__c,Quote_Line_Item__c,Requested_Date__c,Unit_price__c,Or_Carrier__c,Or_orderdate__c from order_batch__c  where  Quote_Line_Item__r.Quote1__c= : Apexpages.currentPage().getParameters().get('Id')];
        String JSONString = JSON.serialize(bclist);

visualforcecode:

    <apex:column >
    <apex:facet name="header">S.NO</apex:facet>
     <apex:outputText value="{!FLOOR(rowNum)}"/>
     <apex:variable var="rowNum" value="{!rowNum + 1}"/></apex:column>
<apex:column ><button onClick="MoveUp();">&#8679;</button></apex:column>
</apex:column><button onClick="MoveDown();">&#8681;</button></apex:column>

I am send a list through http request .I am using row num option for numbering .According to the customer po they want to change the order so that i am using javascript to change the items up and down .According to that row num is changing .

The problem how can i define the rownum in my list order.

Thanks in advance:

1

I think wrapping this would be ideal if indexing of list is needed

public class OrderBtachWrapper(){

  public order_batch__c orderbatch{get;set}
  public integer rowno{get;set;}

}
integer c=0;
List< OrderBtachWrapper> lstOrderWrapper=new List< OrderBtachWrapper>();
for(order_batch__c o:[selectOrder_numbering__c,Or_clientpn__c,Or_customerid__c,Or_customer_PO_Number__c,Or_Nicomatic_p_n__c,Or_Quote_number__c,Quantity_Ordered__c,Quote_Line_Item__c,Requested_Date__c,Unit_price__c,Or_Carrier__c,Or_orderdate__c from order_batch__c  where  Quote_Line_Item__r.Quote1__c= : Apexpages.currentPage().getParameters().get('Id')];){
       OrderBtachWrapper obatch=new OrderBtachWrapper();
      obatch.orderbatch=obatch;
     obatch.rowno=c;
    c=c+1;
    lstOrderWrapper.add(obatch);


}

 String JSONString = JSON.serialize(lstOrderWrapper.add);

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.