Easyui parser and easyui parser

Source: Internet
Author: User

Easyui parser and easyui parser

When writing code, it is found that if the html code is not written on the page, but the corresponding component is added when a method is executed after the page is loaded, after being added, easyui will not initialize this component for you. At this time, you must manually initialize this component,

For example, in the chat window I wrote below, click the initialization window during the chat, which needs to be used at this time.

$. Parser. parse ('# CC'); // parse the specified Node

The window can be initialized. Otherwise, the append operation will have no effect, but the id cannot be the id of the current component. It must be the id of the parent container of the current component.

For example, <div id = "customerChatWindow" class = "easyui-window"> </div>

This is the window component of easyui. This id cannot be used in parser. Otherwise, it will be ineffective. You must add a parent container to it and use the id of the parent container.

<Div id = "showChatwindow">

<Div id = "customerChatWindow" class = "easyui-window"> </div>

</Div>

$. Parser. parse ('# showchatwindow ');

This operation will work normally.


Function initChatsWindow (oid ){


Var chat = '<div id = "showChatwindow"> ';
Chat + = '<div id = "customerChatWindow" class = "easyui-window" data-options = "title: \ 'chat \', width: 400, height: 600, ';
Chat + = 'collapsible: false, minimizable: false, maximizable: false, onResize: function (width, height) {$ (\ '# messageDataview \'). height (height-38-145);} "> ';
Chat + = '<input id = "customerId" type = "hidden"/> ';
Chat + = '<div id = "chartWindow" class = "easyui-layout" style = "width: 100%; height: 100%;" data-options = "fit: true "> ';
Chat + = '<div data-options = "region: \ 'center \', noheader: true"> ';
Chat + = '<div style = "border-width: 0px; overflow: auto; margin: 0px; width: 100%; height: pixel PX; left: 0px; top: 0px; background-color: white ;"';
Chat + = 'id = "messageDataview"> ';
Chat + = '</div> ';
Chat + = '<div id = "panel-1219" style = "margin: 0px; width: 100%; left: 0px; bottom: 0px; position: absolute; background-color: # d3e1f1; overflow: hidden; "> ';
Chat + = '<div id = "toolbar-1221" style = "width: 100%; left: 0px; top: 0px; height: 22px;"> ';
Chat + = '<table style = "width: 100%"> ';
Chat + = '<tr> ';
Chat + = '<td width = "50%"> ';
Chat + = '<div id = "container-1222" style = "margin: 0px; left: 0px; top: 0px;"> ';
Chat + = ' ';
Chat + = '</div> ';
Chat + = '</td> ';
Chat + = '<td width = "50%" align = "right"> ';
Chat + = '<div style = "border-width: 1px;"> ';
Chat + = '<a href = "javascript: void (0)" onclick = "openOrCloseChatsMessageHistoryInfo ($ (\' # customerId \'). val (); "style =" width: 80px "> ';
Chat + = ' ';
Chat + = '<span id = "button-1225-btnInnerEl" class = "x-btn-inner"> historical message </span> ';
Chat + = '</a> ';
Chat + = '</div> ';
Chat + = '</td> ';
Chat + = '</tr> ';
Chat + = '</table> ';
Chat + = '</div> ';
Chat + = '<div id = "panel-1219-body" style = "width: 100%; left: 0px; top: 26px; height: 95px; overflow: hidden; "> ';
Chat + = '<table style = "border-width: 0px; table-layout: fixed; margin: 0px; width: 100%;" id = "textareafield-1220"> ';
Chat + = '<tbody> ';
Chat + = '<tr id = "textareafield-1220-inputRow"> ';
Chat + = '<td id = "textareafield-1220-bodyEl" colspan = "3" style = "width: 100%;"> ';
Chat + = '<textarea id = "chatcontent" name = "textareafield-1220-inputEl" rows = "4" cols = "20 "';
Chat + = 'style = "width: 96%; overflow: auto;"> </textarea> ';
Chat + = '</td> ';
Chat + = '</tr> ';
Chat + = '</tbody> ';
Chat + = '</table> ';
Chat + = '</div> ';
Chat + = '<div style = "width: 100%; left: 0px; top: 90px; background-color: # d3e1f1;"> ';
Chat + = '<p align = "right" style = "margin: 0;"> ';
Chat + = '<a class = "easyui-linkbutton" href = "javascript: void (0)" onclick = "sendChatsMessage ($ (\' # customerId \'). val (), $ (\ '# chatcontent \'). val (); "style =" width: 80px "> send (Enter) </a> ';
Chat + = '</p> ';
Chat + = '</div> ';
Chat + = '</div> ';
Chat + = '</div> ';
Chat + = '</div> ';
Chat + = '</div> ';
Chat + = '</div> ';

// Add to body
$ ("Body"). append (chat );
// Parse the current component. The id must be the parent node of the component.
$. Parser. parse ('# showchatwindow ');
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.