Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Subgrid and Autocomplete
03/10/2008
03:41
Avatar
slin
Member
Members
Forum Posts: 3
Member Since:
03/10/2008
sp_UserOfflineSmall Offline

Hello!

First of all, thanks to the developpers of jqGrid. This pluggin is just incredibable.

So I'm trying to integrate autocomplete pluggin in a subgrid. For that I've followed the documentation (with datepicker integration) and a post in this forum, explaining how to integrate autocomplete and a grid.

I've been able to make it work in this context but I can't make it work in a subgrid.

I'm using Firebug in order to debur and see any query sent, but nothing happens. It's just as if the autocomplete event is not launched when editing the field.

Here is the code I'm using :

jQuery(”#list”).jqGrid({
    #Main grid definition
    url:'devis.grid.php?id_devis='+<?php echo $_GET['id'];?>,
    datatype: 'xml',
    …,
    subGrid: true,
    subGridRowExpanded: function(subgrid_id, row_id) {
        #Subgrif definition
        var subgrid_table_id, pager_id;
        subgrid_table_id = subgrid_id+”_t”;
        pager_id = “p_”+subgrid_table_id;
        $(”#”+subgrid_id).html(”<table id='”+subgrid_table_id+”' class='scroll'></table><div id='”+pager_id+”' class='scroll'></div>”);
        jQuery(”#”+subgrid_table_id).jqGrid({
            …,
            ondblClickRow:function(id){
                if(id && id!==lastSel){
                    jQuery(”#”+subgrid_table_id).restoreRow(lastSel);
                    jQuery(”#”+subgrid_table_id).editRow(
                        id,
                        true,
                        autocomplete_field(id,”description”,subgrid_table_id),
                        '',
                        'devis.subgrid.php',
                        {'id':id,'id_niv1':row_id,'oper':'edit','id_devis':'<?php echo $_GET['id'];?>'},
                        MAJ_montant_ht()
                        );
                    lastSel=id;
                }
            }
        …
       
       
function autocomplete_field(id,field,table){     jQuery(”#”+id+”_”+field,”#”+table).autocomplete(”include/ac.clients.php”, {
        width: 300,
        multiple: false,
        mustMatch: true,
        matchContains: true,
        formatItem: function formatItem(row) {
            return row[0];
        },
        formatResult: function formatResult(row) {
            return row[0].replace(/(<.+?>)/gi, '');
        }
    });
};

I hope some one could help ;-)

Thanks

Slin

03/10/2008
12:18
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

try this

ondblClickRow:function(id){
                if(id && id!==lastSel){
                    jQuery("#"+id,”#”+subgrid_table_id).restoreRow(lastSel);
                    jQuery("#"+id,”#”+subgrid_table_id).editRow(
                        id,
                        true,

....

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

06/10/2008
01:39
Avatar
slin
Member
Members
Forum Posts: 3
Member Since:
03/10/2008
sp_UserOfflineSmall Offline

Hello !

First of all, thank you for your answer.

But it didn't fix the problem. when adding the "#"+id construction to the jQuery function, I can't edit the row.

Any other idea ?

🙂

Thanks

SliN

06/10/2008
12:40
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

I'm sorry for the bad post - this tottaly is wrong.

Also try in function autocomplete_field function just to put alert and see

if it lunches. If this is the case, then check the input parameters if they are

correct.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

07/10/2008
05:51
Avatar
slin
Member
Members
Forum Posts: 3
Member Since:
03/10/2008
sp_UserOfflineSmall Offline

Hello Tony!

No problem 😉

I've done some tests with Firebug and alerts. It seems that my function "autocomplete_field(id,field,table)" is well called but that the jQuery call is not.

In other words, that mean that next constructionis not good.

jQuery("#"+id+"_"+field,"#"+table).autocomplete("include/ac.clients.php", { ...

I think that it comes from "#"+id+"_"+field,"#"+table

but I can't see why this is not good. Perhaps do I not respect something.

I'll continue my investigation 🙂

Thanks

SliN

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
95 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information