CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Autocomplete in editable grid

Print topic Send  topic

Author Message
graziano

Posts: 3
Posted: 05/27/2010, 9:17 AM

I didn't find a solution in forum and had to set a demo on the fly, so this is my two minutes workaround, not a great piece of code but simple and fast to insert.
I haven't time, but a better solution could be write a new autocomplete function.

Create MYPAGE whith an editable grid
Add autocomplete as usual to MyField
The form id is MyForm, change all with your page, form and control id.

In MYPAGE

In html: (instead of MyForm and MyField you find your form and your field name)

search for PTAutocomplete

  
<!-- BEGIN TextBox cod --><input id="MyFormMyField_{MyForm:rowNumber}" value="{Myfield}" name="{MyField_Name}" autocomplete="off">  
<!-- BEGINF PTAutocomplete PTAutocomplete1 -->  
<div class="dummy0class" id="MyFormMyField_choices">  
</div>  
<!-- ENDF PTAutocomplete PTAutocomplete1 --><!-- END TextBox cod -->  

Change into:

			  
<span id="dummytag0">  
<!-- BEGIN TextBox cod --><input id="MyFormMyField_{MyForm:rowNumber}" value="{MyField}" name="{MyField_Name}" autocomplete="off">  
<!-- BEGINF PTAutocomplete PTAutocomplete1 -->  
<div class="dummy0class" id="MyFormMyField_{MyForm:rowNumber}_choices">  
</div>  
<!-- ENDF PTAutocomplete PTAutocomplete1 --><!-- END TextBox cod -->  
</span>  

ADD before <span id="DUMMYTAG">
ADD after </span>
in <DIV>
- ADD class="dummy0class"
- change id = "MyFormMyField_choices" into "MyFormMyField_{MyForm:rowNumber}_choices" (copy {MyForm:rowNumber} from previous line)

-----------------------------------------------------------------------------------------------

search for PTautocomplete1

  
//Initialize MyFormMyFieldPTAutocomplete1 @12-46827F89  
function MyFormMyFieldPTAutocomplete1_start() {  
        /*  
     if ($("MyFormMyField"))  
        new Ajax.Autocompleter("MyFormMyField", "MyFormMyField_choices", "services/MyPage_MyForm_MyField_PTAutocomplete1.php", {});  
        */  
        dtag = document.getElementsByName("dummytag0");  
        for (i = 0; i < dtag.length; i++){  
                i_id = dtag.getElementsByTagName("input")[0].id;  
                new Ajax.Autocompleter(i_id, i_id + "_choices", "services/CPIA_ACCORDO28_slp_ateco_cod_PTAutocomplete1.php", {});  
        }  
  
}  
//End Initialize slp_atecocodPTAutocomplete1  


Change into:

  
//Initialize MyFormMyFieldPTAutocomplete1 @12-46827F89  
function MyFormMyFieldPTAutocomplete1_start() {  
          
		// if ($("MyFormMyField"))  
          
        dtag = document.getElementsByTagName("dummytag0");  
        for (i = 0; i < dtag.length; i++){  
                i_id = dtag.getElementsByTagName("input")[0].id;  
				//new Ajax.Autocompleter("MyFormMyField", "MyFormMyField_choices", "services/MyPage_MyForm_MyField_PTAutocomplete1.php", {});  
                new Ajax.Autocompleter(i_id, i_id + "_choices", "services/MyPage_MyForm_MyField_PTAutocomplete1.php", {});  
        }  
  
}  
//End Initialize slp_atecocodPTAutocomplete1  

comment or delete if ($(.....
insert code before and } after
change first two parameters in line new Ajax ...

------------------------------------------------------------------------------------

Open page services/MyPage_MyForm_MyField_PTAutocomplete1.php

in php

search CCGetFromPost

  
 $this->DataSource->Parameters["postMyField"] = CCGetFromPost("MyField", NULL);  

change into:

   
$v = array_values($_POST);  
$this->DataSource->Parameters["postcod"] = $v[0];//CCGetFromPost("cod", NULL);  

insert before $v = ....
change $this->DataSource as shown

-----------------------------------------------------------------------

open MyPage_MyForm_MyField_style.css (in main directory)

you find something like this:

  
/*Page Style @1-F453E1F1*/  
  
  
#MyFormMyField_choices {  
    position: absolute;  
}  
#MyFormMyField_choices ul {  
    background-color: white;  
    border: 1px solid black;  
    border-top: none;  
    padding-left: 0px;  
    padding-right: 0px;  
    margin: 0px;  
}  
#MyFormMyField_choices ul li.selected { background-color: #aaa;}  
#MyFormMyField_choices li {  
    list-style-type: none;  
    padding-left: 8px;  
    padding-right: 8px;  
    margin: 0;  
}  
/*End Page Style*/  

change into :

  
.dummy0class {  
    position: absolute;  
}  
.dummy0class ul {  
    background-color: white;  
    border: 1px solid black;  
    border-top: none;  
    padding-left: 0px;  
    padding-right: 0px;  
    margin: 0px;  
}  
.dummy0class ul li.selected { background-color: #aaa;}  
.dummy0class li {  
    list-style-type: none;  
    padding-left: 8px;  
    padding-right: 8px;  
    margin: 0;  
}  

replace #MyFormMyField_choices with .dummy0class


------------------------------------------

save all before publishing.


Tested with latest versions of firefox, chrome, safari and IE

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.