如何在SP.UI.ModalDialog.showModalDialog()中使用SharePoint datepicker?

时间:2018-07-05 05:19:51

标签: datepicker modal-dialog sharepoint-2013

我创建了一个要在SharePoint模式中显示的用户界面。以下是将// CONFIGURATION BITS #pragma config FOSC = HS // Oscillator Selection bits (XT oscillator) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR disabled) #pragma config LVP = OFF // Low-Voltage In-Circuit Serial Programming Enable bit #pragma config CPD = OFF // Data EEPROM Memory Code Protection bit #pragma config WRT = OFF // Flash Program Memory Write Enable bits #pragma config CP = OFF // Flash Program Memory Code Protection bit #define _XTAL_FREQ 8000000 // DEFINING LCD PINS #define RS RD2 #define EN RD3 #define D4 RD4 #define D5 RD5 #define D6 RD6 #define D7 RD7 #include <xc.h> #include "lcd.h" #include <stdio.h> #include <stdlib.h> char kbd_getc(); char kbd_getc(){ int key = 2; char *key2[] = {"3", "4", "5"}; return key2[key]; } void main() { TRISD = 0x00; //PORTD as output for LCD Lcd_Init(); Lcd_Clear(); while(1) { Lcd_Set_Cursor(1,1); char *keypress; keypress = kbd_getc(); Lcd_Write_String(keypress); __delay_ms(50); } } 内容传递到HTML的代码。

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); 内容以使其简短。因此,在这里我想对html文本框使用SharePoint datepicker。到目前为止,我正在使用createdBeforeDate文件将其设置为日期选择器。有什么方法可以在Jquery-ui.js中使用SharePoint datepicker?预先感谢。

1 个答案:

答案 0 :(得分:1)

请检查以下代码。

<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&amp;lcid=2057&amp;langid=1033&amp;tz=-04:00:00.0009373&amp;ww=0111110&amp;fdow=1&amp;fwoy=2&amp;hj=0&amp;swn=false&amp;minjday=109207&amp;maxjday=2666269&amp;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"/>

enter image description here