After a few hours trying to figure this out, decided to post and see if someone wants to have Sunday pity on me and help a guy really trying to learn. I see many many examples of how to write data to the controlbar data elements/items. Downloaded and looked at alot of components on this site by frequent fliers and am not seeing the syntax. Selwyn has a good video on changing button text elements in the controlbar from say a textbox on the UX.
What I am missing is the JS syntax to reference a .data object in the controlbar down into the UX. Say an edit textbox I have added somewhere on the UX. I finally got the data down by passing the value into an argument, then grabbing that. But that has a very sticky duct tape feel to it.
For this example, I am just passing the text into a search of a list. My next step will be to skip bringing value onto the UX into a texbox that is hidden and go straight to calling the search (Gregg I saw you dealt with this recently and I was going to hit you up for code if Ok). But I would like to walk before I try to fly and would be thrilled just to reference the data elements in the CB. I will need to do this anyways in other parts of my app and figured a good Sunday task was to learn how to do this. In other stuff I am building, I will want to pass data elements from the CB into an ajaxcallback to work in xbasic and do sql stuff.
Enough rambling, pics and code below in case the above is clear as mud.
Thanks
Wayne
List beforeSearch event
// Cannot figure out why the code below doesnt work instead. vCBData returns undefined.
// have tried D_QuickSearch[0], [1]
obj = {dialog.object}.getControl('CONTROLBAR_1');
var vCBData = obj.data.D_QuickSearch.value;
{dialog.Object}.setValue('LEDGERLIST_KEYWORDSEARCH',vCBData);
alert(vCBData);
// Code below works executing search with textbox assigned from argument passed from CB.
//var vCurrentArgValue = {dialog.Object}.argumentValue('ARG_SEARCH');
//{dialog.Object}.setValue('LEDGERLIST_KEYWORDSEARCH',vCurrentArgValue);
alert(vCurrentArgValue);
CB_Data.png
CB_Action.png
RenderedUX.png
beforesearchevent.png
What I am missing is the JS syntax to reference a .data object in the controlbar down into the UX. Say an edit textbox I have added somewhere on the UX. I finally got the data down by passing the value into an argument, then grabbing that. But that has a very sticky duct tape feel to it.
For this example, I am just passing the text into a search of a list. My next step will be to skip bringing value onto the UX into a texbox that is hidden and go straight to calling the search (Gregg I saw you dealt with this recently and I was going to hit you up for code if Ok). But I would like to walk before I try to fly and would be thrilled just to reference the data elements in the CB. I will need to do this anyways in other parts of my app and figured a good Sunday task was to learn how to do this. In other stuff I am building, I will want to pass data elements from the CB into an ajaxcallback to work in xbasic and do sql stuff.
Enough rambling, pics and code below in case the above is clear as mud.
Thanks
Wayne
List beforeSearch event
// Cannot figure out why the code below doesnt work instead. vCBData returns undefined.
// have tried D_QuickSearch[0], [1]
obj = {dialog.object}.getControl('CONTROLBAR_1');
var vCBData = obj.data.D_QuickSearch.value;
{dialog.Object}.setValue('LEDGERLIST_KEYWORDSEARCH',vCBData);
alert(vCBData);
// Code below works executing search with textbox assigned from argument passed from CB.
//var vCurrentArgValue = {dialog.Object}.argumentValue('ARG_SEARCH');
//{dialog.Object}.setValue('LEDGERLIST_KEYWORDSEARCH',vCurrentArgValue);
alert(vCurrentArgValue);
CB_Data.png
CB_Action.png
RenderedUX.png
beforesearchevent.png
Comment