• RyanBaker
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I'm still a novice VF developer (but trying) and am working on a volunteer gig helping a non-profit in my community. Everything I've done is working fine, except for one thing. I have a VF page served up a SF Site. The VF page lists families in need (for the upcoming Christmas holiday). Interested people can browse the list and click a link to "sponsor" a specific family. Once a family is sponsored, a checkbox is checked and the family is removed from the VF page. However if two users are looking at the same family on the website at the same time and both try sponsoring that family, we end up with two sponsors for one family. What I want to do is before/during the "click to sponsor" process, I want to "refresh the page or somehow check to make sure that the family is still "not sponsored". If sponsor1 clicks the link, 30 seconds before sponsor 2, sponsor 2 should get a message on the page saying that family is no longer available.

 

Here's the code for the page where sponsors search for families. Sponsors click the link toward the bottom (Page.SOGSponsor):

 

<apex:page Controller="DataTableExampleController" docType="html-5.0" sidebar="false" showHeader="false" standardStylesheets="false" cache="false" >
<apex:stylesheet value="{!$Resource.SOGStyle}"/>

<head>

<apex:includescript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"/>

<style type="text/css" title="currentStyle">
@import "{!URLFOR($Resource.DataTables, 'media/css/demo_page.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/demo_table.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/ColReorder.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/ColVis.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/TableTools.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/ColumnFilterWidgets.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/demo_table_jui.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/examples_support/themes/smoothness/jquery-ui-1.8.4.custom.css')}";
</style>

<script src="{!URLFOR($Resource.DataTables, 'media/js/jquery.dataTables.min.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/jquery.dataTables.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ColVis.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ZeroClipboard.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/TableTools.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ColumnFilterWidgets.js')}"></script>

<script type="text/javascript" charset="UTF-8">

$(document).ready( function () {
var oTable = $('#familytable').dataTable( {
"bProcessing": true,
"bSort": true,
"bAutoWidth": false,
"bJQueryUI": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"sDom": '<"top">iWlfrt<"bottom" p>',

"aoColumnDefs": [ { "bVisible": false, "aTargets": [ ] }],
"oColumnFilterWidgets": { "aiExclude": [ 0, 2, 3, 4 ] }
});
});

</script>

 

</head>

<body>
<a href="top" />

<h2>Family Search</h2>

<table class="display" id="familytable">

<thead>
<tr>
<th>Family ID</th>
<th># of Children</th>
<th>School</th>
<th>Wishes</th>
<th>&nbsp;</th></tr>
</thead>

<tfoot>
<tr>
<th>Family ID</th>
<th># of Children</th>
<th>School</th>
<th>Wishes</th>
<th>&nbsp;</th>
</tr>
</tfoot>

<tbody>
<apex:repeat value="{!Family}" var="c">
<tr>
<td align="center">{!c.Name}</td>
<td align="center">{!c.Number_of_Children__c}</td>
<td>{!c.Schools__c}</td>
<td>{!c.Wishes__c}</td>

<td><apex:outputLink value="{!$Page.SOGSponsor}?id={!c.Name}&name={!c.ID}">Click here to sponsor</apex:outputLink> </td> </tr>
</apex:repeat>
</tbody>
</table>
</body>

</apex:page>

I'm still a novice VF developer (but trying) and am working on a volunteer gig helping a non-profit in my community. Everything I've done is working fine, except for one thing. I have a VF page served up a SF Site. The VF page lists families in need (for the upcoming Christmas holiday). Interested people can browse the list and click a link to "sponsor" a specific family. Once a family is sponsored, a checkbox is checked and the family is removed from the VF page. However if two users are looking at the same family on the website at the same time and both try sponsoring that family, we end up with two sponsors for one family. What I want to do is before/during the "click to sponsor" process, I want to "refresh the page or somehow check to make sure that the family is still "not sponsored". If sponsor1 clicks the link, 30 seconds before sponsor 2, sponsor 2 should get a message on the page saying that family is no longer available.

 

Here's the code for the page where sponsors search for families. Sponsors click the link toward the bottom (Page.SOGSponsor):

 

<apex:page Controller="DataTableExampleController" docType="html-5.0" sidebar="false" showHeader="false" standardStylesheets="false" cache="false" >
<apex:stylesheet value="{!$Resource.SOGStyle}"/>

<head>

<apex:includescript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"/>

<style type="text/css" title="currentStyle">
@import "{!URLFOR($Resource.DataTables, 'media/css/demo_page.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/demo_table.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/ColReorder.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/ColVis.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/TableTools.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/ColumnFilterWidgets.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/css/demo_table_jui.css')}";
@import "{!URLFOR($Resource.DataTables, 'media/examples_support/themes/smoothness/jquery-ui-1.8.4.custom.css')}";
</style>

<script src="{!URLFOR($Resource.DataTables, 'media/js/jquery.dataTables.min.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/jquery.dataTables.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ColVis.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ZeroClipboard.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/TableTools.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ColumnFilterWidgets.js')}"></script>

<script type="text/javascript" charset="UTF-8">

$(document).ready( function () {
var oTable = $('#familytable').dataTable( {
"bProcessing": true,
"bSort": true,
"bAutoWidth": false,
"bJQueryUI": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"sDom": '<"top">iWlfrt<"bottom" p>',

"aoColumnDefs": [ { "bVisible": false, "aTargets": [ ] }],
"oColumnFilterWidgets": { "aiExclude": [ 0, 2, 3, 4 ] }
});
});

</script>

 

</head>

<body>
<a href="top" />

<h2>Family Search</h2>

<table class="display" id="familytable">

<thead>
<tr>
<th>Family ID</th>
<th># of Children</th>
<th>School</th>
<th>Wishes</th>
<th>&nbsp;</th></tr>
</thead>

<tfoot>
<tr>
<th>Family ID</th>
<th># of Children</th>
<th>School</th>
<th>Wishes</th>
<th>&nbsp;</th>
</tr>
</tfoot>

<tbody>
<apex:repeat value="{!Family}" var="c">
<tr>
<td align="center">{!c.Name}</td>
<td align="center">{!c.Number_of_Children__c}</td>
<td>{!c.Schools__c}</td>
<td>{!c.Wishes__c}</td>

<td><apex:outputLink value="{!$Page.SOGSponsor}?id={!c.Name}&name={!c.ID}">Click here to sponsor</apex:outputLink> </td> </tr>
</apex:repeat>
</tbody>
</table>
</body>

</apex:page>

I have a custom tab for a custom object that is used regularly in our org. We are making the switch to Lightning, but I cannot get this one tab to show up in Lightning. It is available in classic and I can access it from the waffle icon in Lightning. Below are some screen caps of me adding it to our Lightning navigation menu. I've set everything else up the same way and it is working fine. Any thoughts on what I could be missing?

Editing Lightning navigation menu