function clearMultiBox()
{
var IdMPOuter = GetIDOfMultipickOuterControl("FieldName");
$('#'+IdMPOuter).empty();
}
//Multipicker event
function ReRenderSelectObjects()
{
var oSelect = document.getElementsByTagName('select');
var replaceExp = new RegExp(/SelectCandidate/);
for(var x=0; x<oSelect.length; x++)
{
CleanOptionsText(oSelect[x]);
if(oSelect[x].id.indexOf('SelectCandidate') > 0)
{
var selectId = oSelect[x].id;
var btnId = selectId.replace(replaceExp,'RemoveButton');
var spMasterName = selectId.replace(replaceExp,'MultiLookupPicker_m');
var eventHandler = function(aa){
CustomRemoveItemEventHandler(this);
//alert('hi');
//clear multiselect items
clearMultiBox();
//load multiselect items
// myCustomFunctionName();
};
var objRemoveBtn = document.getElementById(btnId);
if(objRemoveBtn){objRemoveBtn.onclick = eventHandler}
var objSelected = document.getElementById(selectId.replace(replaceExp,'SelectResult'));
if(objSelected){objSelected.ondblclick = eventHandler}
eventHandler = null;
}
}
}
function CleanOptionsText(selectObj)
{
var removeExp = new RegExp(/(<([^>]+)>)/ig);
for(var y=0; y<selectObj.options.length; y++)
{
if ((selectObj.options[y].text.indexOf("<DIV") == 0) && (selectObj.options[y].text.indexOf("</DIV>") >= 0))
{
selectObj.options[y].text = selectObj.options[y].text.replace(removeExp,"");
}
}
}
function CustomRemoveItemEventHandler(callingObj)
{
if(callingObj.tagName == 'BUTTON')
{
var replaceExp = new RegExp(/RemoveButton/);
var spMasterObj = window[callingObj.id.replace(replaceExp,'MultiLookupPicker_m')];
GipRemoveSelectedItems(spMasterObj);
var oSelect = document.getElementById(callingObj.id.replace(replaceExp,'SelectCandidate'));
CleanOptionsText(oSelect);
}
else if(callingObj.tagName == 'SELECT')
{
var replaceExp = new RegExp(/SelectResult/);
var spMasterObj = window[callingObj.id.replace(replaceExp,'MultiLookupPicker_m')];
GipRemoveSelectedItems(spMasterObj);
var oSelect = document.getElementById(callingObj.id.replace(replaceExp,'SelectCandidate'));
CleanOptionsText(oSelect);
}
}
No comments:
Post a Comment