erich.wanker Posted May 28, 2014 Share Posted May 28, 2014 Hello folks :-) .. i have a question about changing a icon in a html-generated list: the list has 2 different object-types .. a folder OR a object record every of the 2 object-types has 2 states: selected or unselected - so i have 4 icons posibilitys for 1 record.. folder, selected folder, object, selected object. I CREATE A LIST OF RECORDS LIKE: (with css-hover and onclick-funktion) UniHTMLFrame.HTML.clear; while not eof do begin UniHTMLFrame.HTML.Append('<div class="colorchanger" >'); UniHTMLFrame.HTML.Append('<p class="myUnselectable" '); UniHTMLFrame.HTML.Append(' onclick="ajaxRequest..........'); if ..fieldbyname('OBJECT_TYPE').AsInteger = 1 then // the record is a OBJECT begin if the current record is the selected record then UniHTMLFrame.HTML.Append('<img src="'+uniServerModule.FilesFolderURL+'images/'+'objektr_black_voll.gif'); else UniHTMLFrame.HTML.Append('<img src="'+uniServerModule.FilesFolderURL+'images/'+'objekt_black_leer.gif'); if ..fieldbyname('OBJECT_TYPE').AsInteger = 2 then // the record is a FOLDER begin if the current record is the selected record then UniHTMLFrame.HTML.Append('<img src="'+uniServerModule.FilesFolderURL+'images/'+'folder_black_voll.gif'); else UniHTMLFrame.HTML.Append('<img src="'+uniServerModule.FilesFolderURL+'images/'+'folder_black_leer.gif'); UniHTMLFrame.HTML.Append('</div>');next record; end; // while not EOF The Result looks like ( i put 3 example-pictures in one image) AND NOW THE PROBLEM with my "ONCLICK" - what is starting if i get a AjaxRequest ..: ..it works on Chrome .. but is very dirty and slow .. and IE produces random an AjaxError .. i think the "document.getElementById" -Loop is the problem.. If i click on a record - i get the recordnumber via ajaxRequest.... and after the click - i start my "dirty search and change"-procedure: Query.first; while not eof do begin if ...fieldbyname('OBJECT_TYPE').AsInteger = 1 then begin UniSession.AddJS('document.getElementById("IMAGE'+actual_recordnumber+'").src= ("'+uniServerModule.FilesFolderURL+'/images/'+'folder_black_leer.gif'+'");'); if actual_recordnumber = recordnumber via ajaxRequest then UniSession.AddJS('document.getElementById("IMAGE'+actual_recordnumber+'").src= ("'+uniServerModule.FilesFolderURL+'/images/'+'folder_black_voll.gif'+'");'); end else begin UniSession.AddJS('document.getElementById("IMAGE'+actual_recordnumber+'").src= ("'+uniServerModule.FilesFolderURL+'/images/'+'objekt_black_leer.gif'+'");'); if actual_recordnumber = recordnumber via ajaxRequest then UniSession.AddJS('document.getElementById("IMAGE'+actual_recordnumber+'").src= ("'+uniServerModule.FilesFolderURL+'/images/'+'objekt_black_voll.gif'+'");'); end end; i hope - someone has the time to read my "description" and has a idea how i can solve this ... Thanx and nice greetings from Gastein-valley Erich Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.