我正在尝试修改codeigniter日历,以便为每个单元格提供单独的添加按钮。单击弹出的添加按钮时,将显示弹出的特定日期。为此,当我点击添加按钮时,我想获得所选日期。
我的日历是这样的。
我使用以下模型功能来创建日历
function mycal_model() {
$this->conf = array(
'show_next_prev' => True,
'next_prev_url' => base_url() . 'index.php/dashboard/index/'
);
$this->conf['template'] = '
{table_open}<table cellpadding="1" cellspacing="2" class="calendar">{/table_open}
{heading_row_start}<tr>{/heading_row_start}
{heading_previous_cell}<th class="prev_sign"><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
{heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
{heading_next_cell}<th class="next_sign"><a href="{next_url}">>></a></th>{/heading_next_cell}
{heading_row_end}</tr>{/heading_row_end}
//Deciding where to week row start
{week_row_start}<tr class="week_name" >{/week_row_start}
//Deciding week day cell and week days
{week_day_cell}<td >{week_day}</td>{/week_day_cell}
//week row end
{week_row_end}</tr>{/week_row_end}
{cal_row_start}<tr class= "days">{/cal_row_start}
{cal_cell_start}<td>{/cal_cell_start}
{cal_cell_content}
<div class="day_num">{day}<button type="button" class="add_btn">+</button>
</div>
<div class="content" style="width:50%; height:40px;">{content}
</div>
{/cal_cell_content}
{cal_cell_content_today}
<div class="day_num highlight">{day}<button type="button" class="add_btn">+</button>
</div>
<div class= "content">{content}</div>
{/cal_cell_content_today}
{cal_cell_no_content}<div class="day_num">{day}<button type="button" class="add_btn">+</button>
</div>
<div class="content1" style="width:50%; height:35px; display:block; float:left; background-color:#95FF95; text-align:center; vertical-align:middle; "><a href="#">+</a>
</div>
<div class="content2" style="width:50%; height:35px; display:block; float:left; background-color:#95FF95; text-align:center; vertical-align:middle; "><a href="#">+</a>
</div>
<div class="content3" style="width:50%; height:35px; display:block; float:left; background-color:#95FF95; text-align:center; vertical-align:middle; "><a href="#">+</a>
</div>
<div class="content4" style="width:50%; height:35px; display:block; float:left;; background-color:#95FF95; text-align:center; vertical-align:middle; "><a href="#">+</a>
</div>
{/cal_cell_no_content}
{cal_cell_no_content_today}<div class="day_num highlight">{day}<button type="button" class="add_btn">+</button>
</div>
<div class="content1" style="width:50%; height:35px; display:block; float:left; background-color:#95FF95; text-align:center; vertical-align:middle; "><a href="#">+</a>
</div>
<div class="content2" style="width:50%; height:35px; display:block; float:left; background-color:#95FF95; text-align:center; vertical-align:middle; "><a href="#">+</a>
</div>
<div class="content3" style="width:50%; height:35px; display:block; float:left; background-color:#95FF95; text-align:center; vertical-align:middle; "><a href="#">+</a>
</div>
<div class="content4" style="width:50%; height:35px; display:block; float:left;; background-color:#95FF95; text-align:center; vertical-align:middle; "><a href="#">+</a>
</div>{/cal_cell_no_content_today}
{cal_cell_blank} {/cal_cell_blank}
{cal_cell_end}</td>{/cal_cell_end}
{cal_row_end}</tr>{/cal_row_end}
{table_close}</table>{/table_close}
';
}
我为添加按钮的按钮点击事件提供了以下脚本。但我只能显示弹出窗口。我不知道如何获得所选日期。
$(".calendar .days td .add_btn").click(function() {
$('#events_add_modal').modal('show');
});
如果有人的想法会有很大帮助。
答案 0 :(得分:0)
我建议您使用this page上的视频。他在视频中使用jquery大约30分钟来构建一个onClick事件,该事件返回被点击的日期。它很容易扩展以返回完整的日期。
希望你能发现它有用。