Jump to content

O.T.: change Icon of selected row in html-selfmade list


erich.wanker

Recommended Posts

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)
post-1295-0-96108200-1401279204_thumb.jpg
 
 
 
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

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...