How do i change the value of ItemHeader.Text in ListView while using LiveBinding - delphi

I've been stuck on this problem for a while now. I have a ListView that's filled via a RESTclient etc. i get categories from the server that go from 0 to 15 and i want to rename the 0 to Test. I know this is easely solvable by just changing it server side but i want to try and fix this on client side so i learn more about delphi.
The problem mostly is getting the specific value out of an event. i can get the value from OnAssigningValue but its all dumped in variable and i have 2 .Text values linked to the listview so i can't go that way either.
i can't find any solution across the interwebs, any help would be appriciated

Related

Enteprise Architect element MiscData(0) change (PDATA1)

I guess it's a simple question, but i still couldn't figure out how can i change the PDATA1/MiscData(0) property of an element via Add-In (and not by SQL Update). The problem is that the documentation says the MiscData is read-only.
Basically i am trying to make a hyper-link on a diagram with the help of an Add-In.
I create a simple Text typed EA.Element, then an EA.DiagramObject, connect them via ElementID and i need this Text typed object to point to an exact diagram.
What i know is that a hyper-link is a Text typed object with PDATA1 filled in with the wanted diagram's ID. The created element's Notes is already filled with a valid hyperlink's value like: packageName : diagramName.
I'm interested in any other ways to make a working hyper-link with the help of an Add-In.
Thanks in advance for the answer!
Tamas
You need to call
Repository.Execute("UPDATE t_object set PDATA1 ...")
Execute is an undocumented but ever since working last resort. Nobody knows why MiscData is r/o.
In oder to make the changes visible on the diagram you need to call
Repository.ReloadDiagram (diagram.DiagramID)
Since EA will eventually pop-up a save-window for modified diagrams you should eventually call
Repository.SaveDiagram (diagram.DiagramID)
prior to the reload.
Important note: You need to remember that the Execute bypasses the API. If you have diagram changes and call Execute on diagram objects they need to be saved before. EA only updates all changed diagram objects in the database when the whole diagram is saved (manually or via SaveDiagram).

Unable to get ampersand (&) to display in a Delphi TActionMainMenuBar

I am in need of help trying to get the ampersand character to show up in a Delphi XE6 VCL TActionMainMenuBar. I have come across similar requests on Stack Overflow but none that directly address the problem I am having.
When creating an action in the TActionManager, I need the caption of an action to read Network & Database. I have tried using two ampersands in the caption Network && Database to escape the accelerator which did not work. When I included two ampersands, I ended up with Network _Database (See Screenshot1). I have also set the property of ActionBar > Items > AutoHotKeys to false and ActionMainMenuBar > PersistentHotKeys to false. Doing so did not rectify the my issue.
The one thing I did try out of pure desperation that I thought fixed it was to include four ampersands Network &&&& Database which when ran showed up as Network & Database (See Screenshot2). However during testing, if I were to press Alt to turn on hotkeys and navigate into the menu, the caption of the action would read Network && Database. I tried to include a screenshot of this however since I have less than 10 reputation points Stack Overflow limits my post to two attachments.
If anyone can point me in the right direction of if I have left out some information please let me know. I've run out of ideas on how to fix this and I cannot come across anything similar when searching Google. Thanks in advance for the help.
You can fix it on your form's onshow event
action3.caption := 'Network &&Database';

Loading select options after setting value

My program flow requires that I first set the value of a select option in the Viewmodel and then I load the available options into the Viewmodel. This causes problems, typically the first available option will be seen in the selection list after this, while the selected option value stays at the specified value.
I was hoping that setting the new "valueAllowUnset" would help, but instead my page becomes unresponsive when using it.
Therefore I currently set the original value again after loading the options. Strangely, this only works when I set the value, set a different value and then set the value again, e.g.
self.data()[field](orgValue);
self.data()[field]({});
self.data()[field](orgValue);
(I store values for multiple selection lists in the self.data observable and access them with the property index "field".)
I tried to strip this down to a simple JSFiddle (http://jsfiddle.net/timvdh/HN6DE/), but the behavior does not show there, although the example pretty much resembles my actual application. However, I am using about 30 select lists there.
So I was hoping, that someone can make an educated guess about what goes wrong in my application, I am hoping that the fact that I have to set the original value three times maybe gives a clue.
EDIT: This fiddle demonstrates, that setting the selected option before and after filling the options list does work with "valueAllowUnset": http://jsfiddle.net/timvdh/HT5Tp/
I am using JQuery Mobile with knockout.js and that caused the problem (sorry I did not even think about JQM being the problem in the first place). I am now setting the option before filling the list and after filling the list I call
$("#selectmenuID").selectmenu("refresh");
to display the option.
The hanging browser was not caused by knockout, there are additional subscriptions to the selectmenus in my app. "valueAllowUnset" changed the behavior of the selectmenus and triggered loops caused by problems in my code.

Telerik Grid (MVC) does not display returned JSON

I have a telerik MVC grid. After making some changes to the underlying code, the grid no longer shows the results returned from the server. I can see the correctly formatted JSON return from the server (using functionality from Web Developer Toolbar), but the grid never actually shows the data. However, it also doesn't generate an error. The loading icon just keeps spinning.
Does anyone have a suggestion on how to localize the problem? Thanks.
EDIT
Well, I managed to get a step further. Apparently something goes wrong in the "bindData"-function located in telerik.grid.js. More specifically in line 462:
460. var evaluate = column.display;
461. if (evaluate)
462. html.cat(evaluate(data[rowIndex]));
When trying to render the last column in the first row, evaluate is set to anonymous and somehow, this results in an "invisible" exception. The markup of this column is:
columns.Bound(c => c.DocumentId)
.ClientTemplate("<a href=\"" + Url.Content("/") +
"/document/<#= DocumentId #>\" target=\"_blank\"><#= Naam #></a>")
.Filterable(false)
.Title("Naam");
I don't understand why this would be a problem, as I use similar templates elsewhere without any problem.
EDIT
Ok, I got it. Apparently some exceptions will not be shown in the Firefox/Firebug console. However, Visual Studio together with IE do not have this problem. I finally discovered that indeed the field "Naam" was missing in the IEnumerable.
So something to take away here is never to trust the results from just one browser ;-)
I had a similar behaviour recently when I had changed the type that the grid was expecting.
Make sure that your ajax call is returning the correct IEnumerable that is specified in the grid markup.
You need to post code for the GridAction and markup if you want a more accurate answer.

auto_complete_for: prevent the first item from being auto-selected

The auto_complete_for dealio from script.aculo.us is great an all, but is there a way for me to selectively disable the fact that it always auto-selects the first item in the list?
The problem is that, if I want to type my own entry that is new, and novel, I don't want the first item in the list to be auto-selected. The reason is because when I TAB out of the field, it selects, and fills the text box with that first item.
I got around that, somewhat, by making the first item in the list the same as what I'm typing, but that's not perfect either, because the auto_complete list doesn't always update with every keystroke, depending on how fast I type. I've tried setting the list refresh rate to the lowest value (1 millisecond) but no go.
What I really want is an option in "auto_complete_for" that doesn't select that first item at all - the same way that Google Instant doesn't automatically select the first suggested search phrase - you have to arrow-down to select one.
Maybe I can do this via an HTML option that I'm missing?
Looking at the source, there doesn't appear to be an option for that, but I bet if you changed line 284 of controls.js to this.index = -1; it would do what you want.
Otherwise, it might be time to look for a different autocomplete widget.
If your requirements are too far away from the available plugin, then I guess there is no point in tinkering around. Its best to write your own JS code.
You might want to consider this: https://github.com/laktek/jQuery-Smart-Auto-Complete
or this : https://github.com/reinh/jquery-autocomplete
I'll add another alternative that works great with Rails 3:
http://github.com/crowdint/rails3-jquery-autocomplete
I recently implemented auto complete for more than a field for Rails 2.0.2.
The plugin I used is:- https://github.com/david-kerins/auto_complete . Not sure if it supports Rails 3.
I have also encountered issues on implementing the above scenario and have posted questions( Implementing auto complete for more than one field in Rails ; Implementing a OnClick kind of functionality and formatting wrt Rails Partial-Views ) on stackoverflow for the same, I have been lucky on getting things working for me based on my requirement.
Kindly refer to these questions, they might have relevance to your requirement.

Resources