You need to sign in to do that
Don't have an account?
Gonzalo Lazzaroni 1
sortable doesn't work
Hello everyone, I'm new in salesforce
I want to use drag and drop in my pageblock but I can't. I've created a custom field in Accounts and display data by customfield (level__c). I want to group the accounts by groups (level 1, level 2, level 3).
This is my code:
Controller:
Thank you, greetings
I want to use drag and drop in my pageblock but I can't. I've created a custom field in Accounts and display data by customfield (level__c). I want to group the accounts by groups (level 1, level 2, level 3).
This is my code:
Controller:
public with sharing class TheController { public List<Account> accounts {get;set;} public String[] levels {get;set;} public void load(){ accounts = [SELECT Id, Name, level__c FROM Account WHERE level__c IN ('level 1', 'level 2', 'level 3')]; Set<String> levelSet = new Set<String>(); for (Account a : accounts) levelSet.add(a.level__c); levels = new String[levelSet.size()]; Integer i = 0; for (String level : levelSet){ levels[i] = level; i++; } } }
<apex:page controller="TheController" action="{!load}"> <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"/> <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"/> <apex:stylesheet value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css"/> <script> $(document).ready(function(){ implementSortable(); }); function implementSortable(){ $( "#sortable" ).sortable(); $( "#sortable" ).disableSelection(); } </script> <apex:repeat value="{!levels}" var="level"> <apex:pageBlock title="{!level}"> <apex:repeat value="{!accounts}" var="account"> <apex:outputPanel id="sortable" rendered="{!IF(level=account.level__c,true,false)}"> {!account.Name} - {!account.level__c}<br/> </apex:outputPanel> </apex:repeat> </apex:pageBlock> </apex:repeat> </apex:page>
Thank you, greetings
hope will help you!