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
Autocomplete
01/12/2008
23:41
Avatar
Barry
Texas, USA
Member
Members
Forum Posts: 38
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

I successfully configured autocomplete (inline edit).

My autocomplete returns UserName and UserID.

I want Username to be visible and UserID returned to the server.

1. If UserID is hidden then I can't seem to change it.

Is there a way that autocomplete results will bind like when using editoptions:{value:"FE:FedEx;IN:InTime;TN:TNT;AR:ARAMEX"}?

Perhaps someone has done this in a clean way and can reccommend a plan of attack.

Thanks!

02/12/2008
04:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello Barry,

One possible solution is to use the events available in autocomplete -

i.e. if the value is selected - get the id and set it to the grid using

setRowData method. I reccomend you to use aftersavefunc for this

purpose.

Best Regads

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.

04/12/2008
11:03
Avatar
Barry
Texas, USA
Member
Members
Forum Posts: 38
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

I guess I am doing something wrong. The aftersavefunction is not being called.

…editRow(”+cl+”,true,onEditFunc1,null,null,null,null,onAfterSave1);>”;

function onEditFunc1(id){
  jQuery(”#”+id+”_EntityName”,”#grid1″).
  autocomplete(”/ajax_server/autocomplete/group_lookup.php”, {
    width: 100,
    selectFirst: false
  });
}

function onAfterSave1(id){
  $(”#”+id+”_EntityName”).result(function(event, data, formatted) {
    if (data)
      //alert(formatted);
      //alert(data[0] + ” ” + data[1]);
      //jQuery(”#”+id+”_EntityID”,”#grid1″).val(data[1]);
      jQuery(”#grid1″).setRowData(id,{'EntityID':data[1]});     
  });
}

Is this what you had in mind?

Barry

04/12/2008
13:13
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello Barry,

The result function of autocomplete is better to be in onEditFunc.

Also - the trick.

Define one global variable in the scope, set this variable in result

function and the in aftersave function change the needed grid cell.

If you change only one value I suggest you to use setCell method

(see docs)

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.

04/12/2008
17:05
Avatar
Barry
Texas, USA
Member
Members
Forum Posts: 38
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

Tony,

The forum software is no good.

I don't understand what you said because
key text is missing.

How do I get the aftersave function to fire?

09/12/2008
06:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

var myvalset;

….

function onEditFunc1(id){
  jQuery(”#”+id+”_EntityName”,”#grid1″).
  autocomplete(”/ajax_server/autocomplete/group_lookup.php”, {
    width: 100,
    selectFirst: false
  });

  $(”#”+id+”_EntityName”).result(function(event, data, formatted) {
    if (data) {
      myvalset = data[1];     

} else { myvalset = null;}
  });

}

function onAfterSave1(id){
    if (myvalset) {
      jQuery(”#grid1″).setRowData(id,{'EntityID':myvalset});

}
}

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
65 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