Hi,
I am using a WebDropDown with a custom table template.
I just want to add a new template item at cliet side using javascript or jQuery.
Please suggest.
My aspx page code given below :
="DropDown"
="true"
="false"
="OrderID">
>
="1"
='clsHeaderDate'>
="20%">
="0">
="25">
<%
)%>
="display: none">
="dllSelectionChange"/>
Hi Petar,
Thanks for your quick reply.
Unfortunately the solution provided by you did not work as it is saying that method "insertRow()" is undefined.
I also tried the below piece of code which workd for me but giving an error while selecting that newly added item. Please have a look and let me know how can I fix this.
function addItem() {
var combo = $find('ddlOrder');
var item = combo.get_items().createItem();
var html_item ="<table style='width: 100%; border-collapse:collapse' cellspacing='1' cellpadding='0' border='0'><TBODY><tr class='clsRowDataLabel' height='25'><td width='20%'>999999</td><td width='20%'>Sample Style</td><td width='20%'>PAC9999</td><td width='20%'>99999</td><td width='20%'>4/5/2012 12:00:00 AM</td><td style='display: none'>999999~Sample Style~PAC9999~99999</td><td style='display: none'>99999</td></tr></TBODY></table>";
item.set_text(html_item);
item._element.innerHTML=html_item;
item.set_value(
'99999');
combo.get_items().add(item);
//combo.get_items().getItem(0).get_element().children[0].insertRow(0).insertCell(0).textContent = 'This is a new cell in a new row';
}
Hi wfx,
Thank you for posting in the community.
If your requirement is to add a new row in the templated table inside an item's container, this can be achieved by accessing the dropdown item's element, for istance:
ig_controls.WebDropDown1.get_items().getItem(0).get_element().children[0].insertRow(0).insertCell(0).textContent = 'This is a new cell in a new row';
More information and instructions on how to add items in WebDropDown client-side may be found at:
http://blogs.infragistics.com/forums/p/27710/253640.aspx
Please let me know if this helps.