function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC@ErrorSFDC@Error 

Need to Reorder the row ...

Hi All

I have a custom requirement.I have created a PDF uisng vf page.in PDF it is fecthing data with table format.customer want to reorder the row and print the PDF with customized reoder format.I have tried ,but it is not updating the PDF..Can anyone help me.
<apex:page standardController="Quotation_Line_Item__c" extensions="RelatedListController" sidebar="true" showHeader="false" lightningStylesheets="true" docType="html">     

<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="../demo.css" type="text/css" rel="stylesheet" />

<!-- Bootstrap CSS -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" />

<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

<!-- jQuery UI CSS -->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

<script type="text/javascript">

$(document).ready(function() {
    //Helper function to keep table row from collapsing when being sorted
    var fixHelperModified = function(e, tr) {
        var $originals = tr.children();
        var $helper = tr.clone();
        $helper.children().each(function(index)
        {
          $(this).width($originals.eq(index).width())
        });
        return $helper;
    };

    //Make diagnosis table sortable
    $("#diagnosis_list tbody").sortable({
        helper: fixHelperModified,
        stop: function(event,ui) {renumber_table('#diagnosis_list')}
    }).disableSelection();


    //Delete button in table rows
    $('table').on('click','.btn-delete',function() {
        tableID = '#' + $(this).closest('table').attr('id');
        r = confirm('Delete this item?');
        if(r) {
            $(this).closest('tr').remove();
            renumber_table(tableID);
            }
    });

});


//Renumber table rows
function renumber_table(tableID) {
    $(tableID + " tr").each(function() {
        count = $(this).parent().children().index($(this)) + 1;
        $(this).find('.priority').html(count);
    });
}



</script>

<style type="text/css">
.ui-sortable tr {
    cursor:pointer;
}
        
.ui-sortable tr:hover {
    background:rgba(244,251,17,0.45);
}

</style>

</head>

<body>

<div id="content" class="container">

            <table class="table" id="diagnosis_list" >
                <thead>
                    <tr><th>Action</th><th>Quote Product Line Item Name</th><th>Basic Unit Price</th><th>Quantity </th><th>Size </th></tr>
                </thead>
                
                <tbody>
                 <apex:repeat value="{!contacts}" var="c" >
                    <tr><td class='priority'>1</td><td>{!c.Name}</td><td>{!c.Basic_Unit_Price__c}</td><td>{!c.Quantity__C}</td><td>{!c.Size__c}</td><td><a class='btn btn-delete btn-danger'>Delete</a></td></tr>
                   </apex:repeat>
                </tbody>
                 
            </table>

</div>

</body>
</html>



    <apex:form >                 

        
        
    </apex:form>  

</apex:page>
Satish PrajapatSatish Prajapat

Hello SFDC@Error,

Please write apex logic:
which can able to change your contacts list.
Please refer below code:
 

//Moving first object to the last
//Contact List is "contacts" that contain the all the contact.
contact con = new Contact();
List<Contact> conList = contacts;
for(Contact ss : contacts)
{
       contacts.remove(ss);
       contacts.add(ss);
       break;
}
//use above logic which may help you.

Thanks,

Satish.