如果在Apex-Repeat中选中了特定的复选框,是否可以在SetImeout中禁用其他复选框?

发布于 2025-01-23 13:28:47 字数 1325 浏览 0 评论 0原文

我有一个可以更新多个值的程序,我想在单击Spesific复选框后2秒钟给Settimeout 2秒。当Settimeout加载Apex-Repeat中的其他复选框时,将禁用SettiMeout在其他复选框上时,将再次启用。

我尝试了很多方法,但仍然没有弄清楚。是否可以?

这是我的代码:

<apex:repeat value="{!dataSalesPlan}" var="i">
<apex:inputCheckbox styleClass="checkOpex{!i.spd.ID} checkOpex {!i.spd.ID}" value="
{!i.opex}">
   <apex:actionSupport event="onchange" action="{!updateOpex}" reRender=""> 
   <apex:param name="salesPlanIndex" value="{!i.index}" assignTo="{!salesPlanIndex}"/>
   </apex:actionSupport>
</apex:inputCheckbox>
</apex:repeat>

javaScript:

<script type="text/javascript">
    document.documentElement.style.setProperty('--screen-width', (screen.width - 120)+'px');
    j$ = jQuery.noConflict();
    
    j$(document).ready(function() {
        j$(document).on('change', '.checkOpex', function(e) {
            var self = $(this);
            $(this).prop('disabled', true);
            setTimeout(function() {
            $(self).removeAttr('disabled');
            alert("Succesfully Set Data");
            }, 2000);
        });
    });

ilustration

i have a program that can update multiple value, i wanted to give settimeout 2 second after click on spesific checkbox. when settimeout is loading the other checkbox in apex-repeat is disabled and when the settimeout is over the other checkbox will be enable again.

i tried so many ways and still not figure it out. is it possible?

this is my code now:

<apex:repeat value="{!dataSalesPlan}" var="i">
<apex:inputCheckbox styleClass="checkOpex{!i.spd.ID} checkOpex {!i.spd.ID}" value="
{!i.opex}">
   <apex:actionSupport event="onchange" action="{!updateOpex}" reRender=""> 
   <apex:param name="salesPlanIndex" value="{!i.index}" assignTo="{!salesPlanIndex}"/>
   </apex:actionSupport>
</apex:inputCheckbox>
</apex:repeat>

Javascript:

<script type="text/javascript">
    document.documentElement.style.setProperty('--screen-width', (screen.width - 120)+'px');
    j$ = jQuery.noConflict();
    
    j$(document).ready(function() {
        j$(document).on('change', '.checkOpex', function(e) {
            var self = $(this);
            $(this).prop('disabled', true);
            setTimeout(function() {
            $(self).removeAttr('disabled');
            alert("Succesfully Set Data");
            }, 2000);
        });
    });

Ilustration
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文