CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

How to select data on load with data link

by bob9999 » 26 Jul 2019 15:17

Hi there.

I have been batting my head against a wall here for days and have to post something to see if some nuggets can be mined.

I have a form with the dropdown component with the list source connected to a query. The drop down works perfectly and I can select items and then all selected list in the drop down (multiple set to true). I can then save the comma delimited list to the database.

The issue I am having is loading the dropdown with what was saved to the database. When I am not using a data source and just static items in the dopdown to select, the SelectByValues(13,34,35) works fine but is ignored when I connect the dropdown items to a data source. Using JSonObj:= SO('13') and then SelectByValue(JSonObj) works but then the number 13 is displayed as a selected item instead of the caption.

When I select an item from the dropdown after load, then the caption is displayed as it should. So then I get the original '13' above and then text in the next item selected.

Part of my issue is I cannot find any documentation on this super object idea that seems to be part working. Is there another way to construct the super object or a better way so then the dropdown has the preselected values for a user when using the dropdown items connected to a data source?

Cheers!
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32

by bob9999 » 03 Aug 2019 01:49

Is there any documentation on how to use this super object methodology or another suggested way to get the drop down to initialize with starting selected values when using a data source for the items to select from? I just cannot get anything but the ID number load in the tags. Cheers!
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32

by Alexander Bulei » 07 Aug 2019 12:06

Hi bob,
You need select by Data:

Code: Select all
 
  JsonObj:= SO();
  JsonObj.S['label']:= 'Drop Value 4';
  JsonObj.S['value']:= '4';
  IWCGJQDropDown1.JQDropDownOptions.SelectByData(JsonObj);


Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by bob9999 » 08 Aug 2019 04:59

Thanks Alex. Unfortunately this does not select the data the same way as if the user did so what occurs is ddContactSearchTags.SelectedList.CommaText is empty string. The display looks nice now with the label (yeah!) but nothing was actually selected inside the drop down that I can gain access to. If I just click into the field and then inspect the commalist, all is set so once I can get the command to mimic this in code, then I am off to the races and I can call this after the selectbydata command.

I found a way to get multiple selects with an array and it is like the items are selected since I cannot select the items again and when I delete the item then I can select again. When I do this then the commatext is set correctly. So the SelectByData is only part of the solution it seems and there is a magic command after to complete the commatext to be set.

Another issue is that I get the comma list back from the db. '13,16' in this case. So it looks like I have to manually search the dataset that feeds into the drop down for each comma delimited item to then parse into this super object method to get the labels loaded. Is there any way for the system to just get fed the commalist somehow and it just takes care of all this overhead itself? If the user has 10 things selected that was saved there will be more overhead to parse all of this manually.

GroupJson := TSuperObject.Create(stArray);
JsonObj:= SO();
JsonObj.S['label']:= 'Buyer';
JsonObj.S['value']:= '13';
GroupJson.AsArray.Add(JsonObj);
JsonObj:= SO();
JsonObj.S['label']:= 'Investor';
JsonObj.S['value']:= '16';
GroupJson.AsArray.Add(JsonObj);
ddContactSearchTags.JQDropDownOptions.SelectByData(GroupJson);
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32

by Alexander Bulei » 13 Aug 2019 12:41

Hi bob9999,

Its seems the dropbox doesnt support the multiple values with datalink :(
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by bob9999 » 15 Aug 2019 22:25

Thank you alex. That does appear to be the case. Seems like there is just something missing in there where the final step of setting that comma list is the issue. Is there an idea when this would be able to be fixed?

The reason I moved this way was that in certain situations I cannot narrow down yet, static items will not load into the drop down so then the user will just see an empty list. Perhaps a local cache issue since when the browser is closed and reopened then all seems OK for a time. The data is there to load the items but will not render on the PC screen.

I will revert my code back to static items since I need the multiple selections capability and then see if I can narrow when the local browser just won't render the items in the dropdown.

Cheers!
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32

by bob9999 » 01 Oct 2019 16:50

I just ran into this situation again but this time I did not have multiple values for a select. I was able to add a region with a background with an edit field on this that I overlaid on the dropdown layering with zindex to ensure on top of the drop down. So when I set the single value I had, I turn on the overlay and then the user sees the text of the selection. Then in the onblur event, then make the region invisible so then the user is none the wise that the dropdown is displaying a number or value instead of the text for the selection.

It would have been way nicer if I could have access to the text property but it is read only. Of course the even better thing is if this anomaly could be fixed. The select is working perfectly and it is just the display in the dropdown that needs to be fixed so then the text representation or tags for multiselect are displayed instead of the value.

Cheers!
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32

by bob9999 » 17 Jan 2020 17:25

Hi there.

A new feature was asked for in my project and now this issue is causing me an issue. When will this be fixed? I reported this back in August I think it was and now it is January the next year. We need to have the same features when we connect the drop down to a data source. In this situation I have allot of values and it will be very time consuming to add all the values as static items and slow the initial render.

Cheers.
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32


Return to JQDropDown

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.