EasyUI Forum
May 14, 2024, 01:25:07 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Poll
Question: Problem with Calendar's property: showWeek
qwerty - 0 (0%)
qwerty - 0 (0%)
Total Voters: 0

Pages: [1]
  Print  
Author Topic: Problem with Calendar's property: showWeek  (Read 3015 times)
arg-on
Newbie
*
Posts: 4


View Profile
« on: February 09, 2019, 01:35:58 PM »

I try to make calendar's property: showWeek customizable, for example hide or show week numbers and week header
and it's not working.
Can you point me my mistakes, please?
Here is the code bellow:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>First Day of Week - jQuery EasyUI Demo</title>
        <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
        <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
        <link rel="stylesheet" type="text/css" href="../demo.css">
        <script type="text/javascript" src="../../jquery.min.js"></script>
        <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
       
    <script type="text/javascript">
        $(function()
        {
            $('#cc').calendar({showWeek:false});
            changeShowWeek('false');
        });
        function changeShowWeek(atype)
        {
            $('#cc').calendar({
                showWeek:(atype=='false'?'false':'true'),
                weekNumberHeader:(atype=='false'?'':'WK')
            });
        }
    </script>
   
    </head>
    <body>
        <h2>First Day of Week</h2>
        <p>Choose the first day of the week.</p>
       
        <div style="margin:20px 0">
            <select onchange="$('#cc').calendar({firstDay:this.value})">
                <option value="0">Sunday</option>
                <option value="1">Monday</option>
                <option value="2">Tuesday</option>
                <option value="3">Wednesday</option>
                <option value="4">Thursday</option>
                <option value="5">Friday</option>
                <option value="6">Saturday</option>
            </select>
        </div>
       
        <div style="margin:20px 0">
            <select onchange="$('#cc').calendar({year:this.value})">
                <option value="2018">2018</option>
                <option value="2019">2019</option>
            </select>
        </div>       
       
        <div style="margin:20px 0">
            <select onchange="$('#cc').calendar({month:this.value})">
                <option value="1">jan</option>
                <option value="2">feb</option>
                <option value="3">mar</option>               
            </select>
        </div>
       
        <div style="margin:20px 0">
         <span>Show week:</span>               
         <select onchange="changeShowWeek(this.value)">
            <option selected>false</option>
            <option>true</option>
         </select>
        </div>
       
        <div id="cc" class="easyui-calendar" showWeek="false" style="width:250px;height:250px;"></div>
           
    </body>
    </html>

Thank you!
« Last Edit: February 09, 2019, 01:37:48 PM by arg-on » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: February 12, 2019, 12:47:20 AM »

The 'showWeek' should be a boolean value. Please use this code instead.
Code:
function changeShowWeek(atype)
{
    $('#cc').calendar({
        showWeek:(atype=='false'?false:true),
        weekNumberHeader:(atype=='false'?'':'WK')
    });
}
Logged
arg-on
Newbie
*
Posts: 4


View Profile
« Reply #2 on: February 12, 2019, 04:23:45 AM »

Thank you jarry for your help.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!