Prevent deselect a row after clicked same row second time on a b-table - bootstrap-vue

how to prevent deselect a row from a bootstrap b-table?
at intialial state, no rows selected, but after the table is clicked, there is at least and at most 1 row selected. By default, clicking a row 2nd time, it will be deselected. I hope the selected row is still highlighted.
This table is not read-only, instead cells are given editors to support editing, so when current editing row is clicked again, the row must be still highlighted to support cell-editor's events fired correctly.
Background:
This is my template code, cell editor definition is injected via "<slot name="columns" />", and is initialized / cached in 'fields' during 'created' hook.
Method clicked() just write down current row index and process data, when current highlight row is clicked twice, its focus lost.
Sample layout:
<template>
<div>
<b-table ref="ui" :items="val" :fields="fields" responsive sticky-header head-variant="dark" :striped="true"
selectable select-mode="single" #row-clicked="clicked"
:data-meta="$attrs.name" v-bind="{...$attrs}" data-ui="16" :style="style" class="w-100 mx-0"
v-contextmenu:ctxMenu >
<slot name="events" />
<slot name="columns" />
<template #table-colgroup="scope">
<col v-for="(field, index) in scope.fields" :key="field.key" :style="field.visible ? index > 0 && field.sz === undefined ? null : (index == 0 ? 'nowrap: nowrap' : ('width: ' + field.sz + 'ch!important')) : 'width: 0!important'" />
</template>
<template v-for="(field, index) in fields" v-slot:[cell(field.key)] = "row">
<table :key="index" :style="index == 0 ? 'width: 20ch' : null" v-if="index == 0" style="p-0">
<tbody>
<tr #click="clickTreeRow(row.index, row.item)">
<td class="m-0 p-0">
<a :key="index" v-if="index === 0" variant="primary" href="#" #click.prevent="switchNode(row.item)" :style="'padding-left:' + row.item.level + 'em'" >
<b-icon :icon="row.item.children.length == 0 ? '' : row.item.expand ? 'folder-minus' : 'folder-plus'"/>
</a>
</td>
<td style="display: inline-block; white-space: nowrap" class="m-0 p-0">
<ui-text :key="'c' + row.index + '_' + field.key" :name="field.key" :type="field.type" :data-options="colOpt(field.key)" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :scale="field.scale" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="fieldClazz" v-if="field.ui=='2'" />
<ui-combo :key="'c' + row.index + '_' + field.key" :name="field.key" :data-options="colOpt(field.key)" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="fieldClazz" v-else-if="field.ui === '9'" />
<ui-check :key="'c' + row.index + '_' + field.key" :name="field.key" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="checkClazz" v-else-if="field.ui === '12'" />
<ui-calendar :key="'c' + row.index + '_' + field.key" :name="field.key" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="fieldClazz" v-else-if="field.ui =='36'" />
<ui-textarea :key="'c' + row.index + '_' + field.key" :name="field.key" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="fieldClazz" v-else-if="field.ui =='10'" />
<ui-label :key="'c' + row.index + '_' + field.key" :name="field.key" :type="field.type" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, index)" :class="fieldClazz" v-else />
</td>
</tr>
</tbody>
</table>
<ui-text :key="'c' + row.index + '_' + field.key" :name="field.key" :type="field.type" :data-options="colOpt(field.key)" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="fieldClazz" v-if="index > 0 && field.ui=='2'" />
<ui-combo :key="'c' + row.index + '_' + field.key" :name="field.key" :data-options="colOpt(field.key)" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="fieldClazz" v-else-if="index > 0 && field.ui === '9'" />
<ui-check :key="'c' + row.index + '_' + field.key" :name="field.key" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="checkClazz" v-else-if="index > 0 && field.ui === '12'" />
<ui-calendar :key="'c' + row.index + '_' + field.key" :name="field.key" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="fieldClazz" v-else-if="index > 0 && field.ui =='36'" />
<ui-textarea :key="'c' + row.index + '_' + field.key" :name="field.key" :data-default="colDef(field.key)" :data-param="colParam(field.key)" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, row.index)" #change="change" :cellEvents="columnEvents[field.key]" :class="fieldClazz" v-else-if="index > 0 && field.ui =='10'" />
<ui-label :key="'c' + row.index + '_' + field.key" :name="field.key" :type="field.type" :layout="colLayout(field.key)" :sz="field.sz" :data-row="row.index" #click="clicked(row, index)" :class="fieldClazz" v-else-if="index > 0" />
</template>
</b-table>
<v-contextmenu ref="ctxMenu" theme="dark">
<v-contextmenu-item #click="addNode()" :disabled="availableActions[0] === false">+</v-contextmenu-item>
<v-contextmenu-item #click="removeNode()" :disabled="availableActions[1] === false">-</v-contextmenu-item>
<v-contextmenu-item divider></v-contextmenu-item>
<v-contextmenu-item #click="move('U')" :disabled="availableActions[2] === false">↑</v-contextmenu-item>
<v-contextmenu-item #click="move('D')" :disabled="availableActions[3] === false">↓</v-contextmenu-item>
<v-contextmenu-item #click="move('L')" :disabled="availableActions[4] === false">←</v-contextmenu-item>
<v-contextmenu-item #click="move('R')" :disabled="availableActions[5] === false">→</v-contextmenu-item>
</v-contextmenu>
</div>
</template>
<script>

Related

How to use SharePoint datepicker in SP.UI.ModalDialog.showModalDialog()?

I have created one user interface which i am displaying in the SharePoint modal. Below is the code where am passing the HTML content to SP.UI.ModalDialog.showModalDialog.
var content = document.createElement('div');
content.className = 'shareDiv';
content.innerHTML = "<head>" +
"<title>Version Cleanup</title>" +
"</head>" +
"<table cellpadding='10px' cellspacing='10px'>" +
"<tr>"+
"<td>" +
"<input type='text' id='createdBeforeDate' />" +
"</td>" +
"</tr>" +
"</table>";
var options = {
title: 'Version Cleanup',
showClose: true,
allowMaximize: false,
html: content
};
SP.UI.ModalDialog.showModalDialog(options);
For time being I have removed extra html content to make it brief. So here I want to use SharePoint datepicker for createdBeforeDate textbox. As of now I am using Jquery-ui.js file to make it a datepicker. Is there any way to use SharePoint datepicker in the SP.UI.ModalDialog.showModalDialog? Thanks in advance.
Please check the following code.
<script type="text/javascript" src="/_layouts/15/datepicker.js"></script>
<script src="//code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#showModalDialog").click(function(){
OpenInformationDialog();
});
});
function OpenInformationDialog() {
var content = document.createElement('div');
content.className = 'shareDiv';
content.innerHTML = "<head>" +
"<title>Version Cleanup</title>" +
"</head>" +
"<table cellpadding='10px' cellspacing='10px'>" +
"<tr>"+
"<td>" +
"<input type='text' id='createdBeforeDate' />" +
"<iframe id='createdBeforeDateDatePickerFrame' title='Select a date from the calendar.' style='display:none; position:absolute; width:200px; z-index:101;' src='/_layouts/15/images/blank.gif?rev=23' class='owl-date-picker'></iframe>"+
"<a role='button' onclick='clickDatePicker(\"createdBeforeDate\", \"/_layouts/15/iframe.aspx?cal=1&lcid=2057&langid=1033&tz=-04:00:00.0009373&ww=0111110&fdow=1&fwoy=2&hj=0&swn=false&minjday=109207&maxjday=2666269&date=\", \"\", event); return false;' href='#'>"+
"<img id='createdBeforeDateDatePickerImage' alt='Select a date from the calendar.' src='/_layouts/15/images/calendar_25.gif?rev=23' border='0'></a>"+
"</td>" +
"</tr>" +
"</table>";
var options = {
title: 'Version Cleanup',
showClose: true,
allowMaximize: false,
html: content
};
SP.UI.ModalDialog.showModalDialog(options);
}
</script>
<input type='button' id='showModalDialog' value="Show Modal Dialog"/>

DJANGO JQUERY-file-upload added file not shown in the template list

I'm trying to use JQUERY-file-upload plugin to upload multiple files, after I added the container and file field, and try to upload, I can select multiple files, but the select files not be shown in the template table list.Below you may find the details:
The input and table as below in the html template:
<input id="fileupload" type="file" name="files[]" multiple>
<table role="presentation"><tbody class="files"></tbody></table>
added the JS library and CSS as below:
<script src="{% static "js/jquery.ui.widget.js" %}" ></script>
<script src="{% static "js/jquery.iframe-transport.js" %}" ></script>
<script src="{% static "js/jquery.fileupload.js" %}" ></script>
<script src="{% static "js/jquery.fileupload-ui.js" %}" ></script>
<link href="{% static "css/jquery.fileupload.css" %}" rel="stylesheet">
<link href="{% static "css/jquery.fileupload-ui.css" %}" rel="stylesheet">
with below JS, I can select multiple files, but the selected files didn't show in the template table:
$('#fileupload').fileupload({
filesContainer: $('table.files'),
uploadTemplateId: null,
downloadTemplateId: null,
replaceFileInput:false,
uploadTemplate: function (o) {
var rows = $();
$.each(o.files, function (index, file) {
var row = $('<tr class="template-upload fade">' +
'<td><span class="preview"></span></td>' +
'<td><p class="name"></p>' +
'<div class="error"></div>' +
'</td>' +
'<td><p class="size"></p>' +
'<div class="progress"></div>' +
'</td>' +
'<td>' +
(!index && !o.options.autoUpload ?
'<button class="start" disabled>Start</button>' : '') +
(!index ? '<button class="cancel">Cancel</button>' : '') +
'</td>' +
'</tr>');
row.find('.name').text(file.name);
row.find('.size').text(o.formatFileSize(file.size));
if (file.error) {
row.find('.error').text(file.error);
}
rows = rows.add(row);
});
return rows;
},
downloadTemplate: function (o) {
var rows = $();
$.each(o.files, function (index, file) {
var row = $('<tr class="template-download fade">' +
'<td><span class="preview"></span></td>' +
'<td><p class="name"></p>' +
(file.error ? '<div class="error"></div>' : '') +
'</td>' +
'<td><span class="size"></span></td>' +
'<td><button class="delete">Delete</button></td>' +
'</tr>');
row.find('.size').text(o.formatFileSize(file.size));
if (file.error) {
row.find('.name').text(file.name);
row.find('.error').text(file.error);
} else {
row.find('.name').append($('<a></a>').text(file.name));
if (file.thumbnailUrl) {
row.find('.preview').append(
$('<a></a>').append(
$('<img>').prop('src', file.thumbnailUrl)
)
);
}
row.find('a')
.attr('data-gallery', '')
.prop('href', file.url);
row.find('button.delete')
.attr('data-type', file.delete_type)
.attr('data-url', file.delete_url);
}
rows = rows.add(row);
});
return rows;
}
});
Any idea on what's wrong on my code? Any help will be appreciated, thanks in advance!

SQL Injection Indication and Solution

Hi I am developing a website starting from the template Metronic (HTML Template Boiler) that uses Bootstrap.
People say that this code have risk SQL injection.
Can you tell me where is code section bad and how can I fix it?
<div class="container main">
<div class="main_pad">
<?php
if(isset($_GET['ID'])) {
$arrayResult = array();
$query = $dbConnect->query("
SELECT
designers.ID AS ID_designer,
designers.nome AS nome_designer,
designers.immagine AS immagine_designer,
designers.testo_IT AS testo_IT_designer,
designers.testo_EN AS testo_EN_designer,
designers.website AS website_designer,
designers.ID_linea AS ID_linea_designer
FROM
designers
WHERE
ID = '" . $_GET['ID'] . "'
");
$result = $dbConnect->extractObject($query);
if(count($result)>0) {
for($i=0;$i<count($result);$i++) {
$fileParts = pathinfo($result[$i]->immagine_designer);
$basename = substr($fileParts['filename'], 0, -4);
$arrayResult = array(
$result[$i]->ID_designer, // 0
utf8_encode($result[$i]->nome_designer), // 1
$basename . '_640.' . $fileParts['extension'], // 2
utf8_encode($result[$i]->testo_IT_designer), // 3
utf8_encode($result[$i]->testo_EN_designer), // 4
$result[$i]->website_designer, // 5
$result[$i]->ID_linea_designer // 6
);
}
}
?>
<div class="col-lg-6 designer">
<img src="images/left-arrow.png">
<h1><?php echo $arrayResult[1]; ?></h1>
<ul class="top-nav nav-tabs" id="specs" role="tablist">
<li class="active">
<?php echo $_SESSION['langPref']=='ENG' ? "BIO" : 'BIOGRAFIA'; ?>
</li>
<li>
<?php echo $_SESSION['langPref']=='ENG' ? "PRODUCTS" : 'PRODOTTI'; ?>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="bio">
<div class="row">
<div class="col-lg-12">
<p style="margin-top: 20px;">
<?php
switch($_SESSION['langPref']){
default :
case 'ENG' :
echo $arrayResult[4];
break;
case 'IT' :
echo $arrayResult[3];
break;
}
?>
</p>
</div>
</div>
</div>
<div class="tab-pane" id="products">
<div class="row">
<div class="col-lg-12">
<?php
$arrayLinesList = array();
foreach(explode(',', $arrayResult[6]) as $lines => $line) {
$arrayLinesList[] = '"' . $line . '",';
}
$query = $dbConnect->query("
SELECT
*
FROM
prodotti
WHERE
prodotti.ID_linea IN (" . substr(implode('', $arrayLinesList), 0, -1) . ")
");
$result = $dbConnect->extractObject($query);
if(count($result)>0) {
echo '<ul style="margin-top: 20px;">';
for($i=0;$i<count($result);$i++) {
$co = '';
if($result[$i]->ID == 58){
$co = '(Claudio Dondoli)';
}elseif($result[$i]->ID == 53 && $_GET['ID'] == 19 || $result[$i]->ID == 40 && $_GET['ID'] == 19 || $result[$i]->ID == 41 && $_GET['ID'] == 19 || $result[$i]->ID == 62 && $_GET['ID'] == 19 || $result[$i]->ID == 63 && $_GET['ID'] == 19) {
$co = '(with Gianfranco Gualtierotti)';
}elseif($result[$i]->ID == 53 && $_GET['ID'] == 7 || $result[$i]->ID == 40 && $_GET['ID'] == 7 || $result[$i]->ID == 41 && $_GET['ID'] == 7 || $result[$i]->ID == 62 && $_GET['ID'] == 7 || $result[$i]->ID == 63 && $_GET['ID'] == 7) {
$co = '(with Giancarlo Vegni)';
}elseif($result[$i]->ID == 26 && $_GET['ID'] == 10 || $result[$i]->ID == 27 && $_GET['ID'] == 10 || $result[$i]->ID == 28 && $_GET['ID'] == 10 || $result[$i]->ID == 29 && $_GET['ID'] == 10 || $result[$i]->ID == 61 && $_GET['ID'] == 10) {
$co = '(with Patricia Urquiola)';
}elseif($result[$i]->ID == 26 && $_GET['ID'] == 18 || $result[$i]->ID == 27 && $_GET['ID'] == 18 || $result[$i]->ID == 28 && $_GET['ID'] == 18 || $result[$i]->ID == 29 && $_GET['ID'] == 18 || $result[$i]->ID == 61 && $_GET['ID'] == 18) {
$co = '(with Sung Sook Kim)';
}
echo '<li>' . utf8_encode($arrayLines[$result[$i]->ID_linea][0]) .'&nbsp'. $result[$i]->nome .' &nbsp' . ($co) .'</li>';
}
echo '</ul>';
} else {
echo '<p style="margin-top: 20px;">This designer has no products listed here!</p>';
}
?>
</div>
</div>
</div>
</div>
</div><!-- /.left_cont -->
<div class="col-lg-6 right_cont">
<img src="admin/assets/admin/layout/img/designers/<?php echo $arrayResult[2]; ?>" class="img-responsive" />
</div><!-- /.right_cont -->
<?php
}
?>
possible injection in
WHERE ID = '" . $_GET['ID'] . "'
for example if $_GET['ID'] = "' or 1 = 1"
solution: use parametrized queries.
One problem (not read all the code) is building sql statements directly from user input (for example get or post data)
In your code you have
WHERE ID = '" . $_GET['ID'] . "'
You should use prepared statements - read How can I prevent SQL injection in PHP?
if ur using PDO then be sure to use:
WHERE `id`=:id
and then use like:
$stmnt = $dbConnect->prepare($sql);
$stmnt->execute(Array(":id"=>$_GET['id']));
also if you want to protect from higher levels search up the magic quotes liberary, that should help you a bit ;)

jquery file upload plugin file upload without refreshing the page

I am using jquery file upload plugin for uploading files to my server but when server returns a json how to display that data without my page refreshing.I know that many posts says using iframe we can acheive i am very new to jquery and ajax can any figure it out and help me thank you in advance.
$('#fileupload').fileupload({
xhrFields: {withCredentials: true},
url: "fileUpload.do?",
type:"POST",
autoUpload: true,
formdata:{name:'FolderId',value:getfolderId()},
});
function getfolderId(){
var FolderId
alert();
$('#fileupload').on("click",function(){
FolderId=document.getElementById('currentFolder').value;
document.getElementById('selectedFolder').value = FolderId;
});
return FolderId;
}`
</form>`<form id="fileupload" on action="fileUpload.do" method="POST" enctype="multipart/form-data">
<div class="row fileupload-buttonbar">
<label for="form-upload">
<img src="htdocs/images/add_file.png"
style="width: 20px; height: 20px; border: 0" >
</label>
<input id="form-upload" type="file" name="upload" multiple style="opacity: 0; filter:alpha(opacity: 0);">
<im:hidden name="selectedFolder" id="selectedFolder" value="1" />
</div>
<div class="col-lg-5 fileupload-progress fade">
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar progress-bar-success" style="width:0%;"></div>
</div>
<div class="progress-extended"> </div>
</div>
</div>
<table role="presentation" class="table table-striped"><tbody class="files"></tbody></table>
</form>`
$('#addFile-link').bind("click",function(){
var FolderId
FolderId=document.getElementById('currentFolder').value;
document.getElementById('selectedFolder').value = FolderId;
if( FolderId==" " || FolderId==0){
$('#input').prop('disabled', true);
showFileMSg();
//alert("kindly select a folder to upload files");
}
else{
$('#input').prop('disabled', false);
$('#fileupload').fileupload({
xhrFields: {withCredentials: true},
url: "fileUpload.do?",
type:"POST",
dataType : "JSON",
autoUpload: true,
formdata:{name:'FolderId',value:FolderId},
disableImagePreview:true,
filesContainer: $('table.files'),
uploadTemplateId: null,
downloadTemplateId: null,
uploadTemplate: function (o) {
var rows = $();
$.each(o.files, function (index, file) {
var row = $('<tr class="template-upload fade">' +
'<td><span class="preview"></span></td>' +
'<td><p class="name"></p>' +
'<div class="error"></div>' +
'</td>' +
'<td><p class="size"></p>' +
'<div class="progress"></div>' +
'</td>' +
'<td>' +
(!index && !o.options.autoUpload ?
'<button class="start" disabled>Start</button>' : '') +
(!index ? '<button class="cancel">Cancel</button>' : '') +
'</td>' +
'</tr>');
row.find('.name').text(file.name);
row.find('.size').text(o.formatFileSize(file.size));
if (file.error) {
row.find('.error').text(file.error);
}
rows = rows.add(row);
});
return rows;
},
downloadTemplate: function (o) {
var rows = $();
$.each(o.files, function (index, file) {
var row = $('<tr class="template-download fade">' +
'<td><span class="preview"></span></td>' +
'<td><p class="name"></p>' +
(file.error ? '<div class="error"></div>' : '') +
'</td>' +
'<td><span class="size"></span></td>' +
'<td><button class="delete">Delete</button></td>' +
'</tr>');
row.find('.size').text(o.formatFileSize(file.size));
if (file.error) {
row.find('.name').text(file.name);
row.find('.error').text(file.error);
} else {
row.find('.name').append($('<a></a>').text(file.name));
if (file.thumbnailUrl) {
row.find('.preview').append(
$('<a></a>').append(
$('<img>').prop('src', file.thumbnailUrl)
)
);
}
row.find('a')
.attr('data-gallery', '')
.prop('href', file.url);
row.find('button.delete')
.attr('data-type', file.delete_type)
.attr('data-url', file.delete_url);
}
rows = rows.add(row);
});
return rows;
},
always:function (e, data) {
$.each( function () {
$(this).removeClass('fileupload-processing');
});
},
done: function (e, data) {
$('.template-upload').remove();
$.each(data.files, function (index, file) {
openFolder(FolderId);
});
},
error: function (jqXHR, textStatus, errorThrown) {
alert("jqXHR: " + jqXHR.status + "\ntextStatus: " + textStatus + "\nerrorThrown: " + errorThrown);
}
/*add: function (e, data) {
$('body').append('<p class="upl">Uploading...</p>')
data.submit();
},*/
})
}
});

datepicker on date hover popup

I'm trying to get a week of dates with data for each day to popup when I hover over the week. I can get it to popup up a display if I click on a date in a week, but I want it to happen on a mouseover/mouseenter. Here is the code I have:
<html>
<head>
<link href="./jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="./jquery.min.js"></script>
<script src="./jquery-ui.min.js"></script>
<script type="text/javascript" src="./popup.js"></script>
<script>
var dateString;
var sundayDate;
var mondayDate;
var tuesdayDate;
var wednesdayDate;
var thursdayDate;
var fridayDate;
var saturdayDate;
$(document).ready(function() {
$("#datepicker").datepicker({
showOtherMonths: true,
selectOtherMonths: true,
onSelect: function(dateText, inst) {
var date = new $(this).datepicker('getDate');
sundayDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay());
mondayDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 1);
tuesdayDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 2);
wednesdayDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 3);
thursdayDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 4);
fridayDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 5);
saturdayDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 6);
}
});
$('td a').live('mouseenter', function () {
popup('<table border="1" width="350">' +
' <tr>' +
' <th>Su</th>' +
' <th>Mo</th>' +
' <th>Tu</th>' +
' <th>We</th>' +
' <th>Th</th>' +
' <th>Fr</th>' +
' <th>Sa</th>' +
' </tr>' +
' <tr height= "50px">' +
' <td valign="top" width = "50px">' + sundayDate.getDate() + '</td>' +
' <td valign="top" width = "50px">' + mondayDate.getDate() + '</td>' +
' <td valign="top" width = "50px">' + tuesdayDate.getDate() + '</td>' +
' <td valign="top" width = "50px">' + wednesdayDate.getDate() + '</td>' +
' <td valign="top" width = "50px">' + thursdayDate.getDate() + '</td>' +
' <td valign="top" width = "50px">' + fridayDate.getDate() + '</td>' +
' <td valign="top" width = "50px">' + saturdayDate.getDate() + '</td>' +
' </tr>' +
'</table>');
});
});
</script>
</head>
<body>
<div class="demo">
<div id="datepicker"></div>
</div>
</body>
</html>
I had read something about using .on instead of .live, as that is the current method, but I still am lost as to how to get a date to get selected on a "mouseover" and it to pupup the current date. I can handle formating the week's table look and inputing the data, but I want the date the mouse is over to be selected and trigger the onSelect action.
Thanks in advance for any repsonse to this.
I think you can trigger this by having a button or other object that contains something to the effect of:
<label onmouseover="mouseenter">move here</label>