Easyui Parser Parser

Source: Internet
Author: User

When writing code to find that if you do not write HTML code on the page at a time, but after the page is loaded to execute a method when the corresponding component is added, Easyui will not give you the initialization of this component, this time you have to manually initialize the component,

As I write below the Chat window, click on the chat to initialize the window, this time need to use

$.parser.parse (' #cc '   ); //parse the specified node

In order to initialize the window, otherwise the append is not effective, but found that it is time for this ID is not the ID of the current component, must be the ID of the current component's parent container

such as: <div id= "Customerchatwindow" class= "Easyui-window" ></div>

This is the window component of Easyui, this ID cannot be used in parser, otherwise it will not work, you must add a parent container with the ID of the parent container

<div id= "Showchatwindow" >

<div id= "Customerchatwindow" class= "Easyui-window" ></div>

</div>

$.parser.parse (' #showChatwindow ');

It's normal to use this.


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:415px; 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 News </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 ($ (\ ' #cust Omerid\ '). 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);
Resolves the current component, the ID must be the parent node of the component
$.parser.parse (' #showChatwindow ');
}

Easyui Parser Parser

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.