Nitobi User Forums Forum Index

    (RSS)
Nitobi User Forums
Nitobi Support Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Update combo from getlist.getpage and update textbox

 
       Nitobi User Forums Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
thor



Joined: 06 Jan 2007
Posts: 1

PostPosted: Sat Jan 06, 2007 1:27 pm    Post subject: Update combo from getlist.getpage and update textbox Reply with quote

Hi and thanks for a great combo :P

I have a form where I get the form data from a ajax function. I then want to update the combo with getlist.getpage and set the record in the combotextbox. I use this code
Code:

function testcombo() {
     pCombo = document.getElementById('w002').object;
     // Clear the list and any other selected values.
    pCombo.GetList().Clear();
    pCombo.GetList().GetPage(0,15,'ajaxrecord');

   pCombo.GetList().SetSelectedRow(0);
   pCombo.GetTextBox().SetValue(pCombo.GetSelectedRowValues()[pCombo.GetTextBox().GetDataFieldIndex;
  }


What goes wrong is of course that the gethandler is not finished when the script is putting row 0 in the textbox and the result is a blank textbox.

I would like to know how to wait until the Getpage is finished, before updating the textbox. This is also the case where we have several comboboxes in same page and we need to know when to start updating next combo to avoid cancel the previous (if not finished)

I have found the GetDatasourceAccessStatus(); but do not understand how to use it. Do not find any doc. on this topic and a sample would be very welcome

Thanks in advance for a.s.a.p. reply :P

Thor
Back to top
View user's profile Send private message
mike_nitobi



Joined: 30 Oct 2006
Posts: 321

PostPosted: Tue Jan 09, 2007 12:46 am    Post subject: Reply with quote

Hi Thor,

You can hook into the GetPage callback by adding a function reference to the the list of arguments passed to the GetPage method.
Code:
pCombo.GetList().GetPage(0,15,'ajaxrecord', null, null, myCallBack);


myCallBack() will be called after the XMLHttpRequest initiated in GetPage is complete:
Code:
function myCallBack()
{
  pCombo = document.getElementById('w002').object;
  pCombo.GetList().SetSelectedRow(0);
  pCombo.GetTextBox().SetValue(pCombo.GetSelectedRowValues()[pCombo.GetTextBox().GetDataFieldIndex()]);
}
Back to top
View user's profile Send private message
Display posts from previous:   
       Nitobi User Forums Forum Index -> General Questions All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group