You need to sign in to do that
Don't have an account?

Visualforce Drag-and-Drop Functionality
i have built a vf page:-
<apex:page controller="TheController">
<apex:stylesheet value="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"/>
<apex:includeScript value="//code.jquery.com/jquery-1.10.2.js"/>
<apex:includeScript value="//code.jquery.com/ui/1.11.2/jquery-ui.js"/>
<script>
$(document).ready(function(){
$(document.getElementById("{!$Component.theForm.thePageBlock.theTable}")).find("tbody").sortable();
});
</script>
<apex:form id="theForm">
<apex:pageBlock id="thePageBlock" >
<apex:pageBlockTable value="{!accounts}" var="account" id="theTable">
<apex:column value="{!account.Name}"/>
<apex:column value="{!account.AccountNumber}"/>
<apex:column value="{!account.OwnerId}"/>
<apex:column value="{!account.Phone}"/>
<apex:column value="{!account.Fax}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
controller:-
public with sharing class TheController {
public List<Account> getAccounts()
{
return [Select Id, Name, AccountNumber, OwnerId, Phone, Fax From Account limit 10];
}
}
hi, this code working good.
but it is working in one section (means i can set the record in any place among all records), if i want to drag a single record from all records and want to drop it in a other page block section(like in list1 i want to display all records , then if i drag a single record and drop it in another pageblock section named list2) .
how this will be possible?
please give me solution..
<apex:page controller="TheController">
<apex:stylesheet value="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"/>
<apex:includeScript value="//code.jquery.com/jquery-1.10.2.js"/>
<apex:includeScript value="//code.jquery.com/ui/1.11.2/jquery-ui.js"/>
<script>
$(document).ready(function(){
$(document.getElementById("{!$Component.theForm.thePageBlock.theTable}")).find("tbody").sortable();
});
</script>
<apex:form id="theForm">
<apex:pageBlock id="thePageBlock" >
<apex:pageBlockTable value="{!accounts}" var="account" id="theTable">
<apex:column value="{!account.Name}"/>
<apex:column value="{!account.AccountNumber}"/>
<apex:column value="{!account.OwnerId}"/>
<apex:column value="{!account.Phone}"/>
<apex:column value="{!account.Fax}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
controller:-
public with sharing class TheController {
public List<Account> getAccounts()
{
return [Select Id, Name, AccountNumber, OwnerId, Phone, Fax From Account limit 10];
}
}
hi, this code working good.
but it is working in one section (means i can set the record in any place among all records), if i want to drag a single record from all records and want to drop it in a other page block section(like in list1 i want to display all records , then if i drag a single record and drop it in another pageblock section named list2) .
how this will be possible?
please give me solution..
Code-1: Moving between same sections from one table to another.
Code-2: Moving between different sections from one pageBlocktable to another.
If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future. Thanks, Sunil
https://salesforcetrail.blogspot.com/2020/04/drag-and-drop-show-and-hide-columns.html