extjs 4 autogenerating a record id - extjs4

I have a map to which features can be added and removed and am using an extjs 4 grid panel as a view (MVC) to list the features. The idea is that the user can click an item in the grid and highlight it in the map, click a button to remove it etc. The features do not have a natural key so I need to make one up, just a number is fine. At the moment the map starts up with some features already on it so I am able to loop through and give each an id and add a record to the store for each to tie the 2 up, but ideally I want the store to take care of that when each record is added. I also have the problem that when a new feature is created I need to get a fresh new id to use but I'd rather not have to loop through all my features to find the highest id.
I am using myStore.add({id:1,name:'blah'...}) to add the records - should I be using this or insert?
Any help appreciated

Yes you can use the store last to figure out your last record, but my recommendation is to handle ID generation to the server side. Typically database sequencer is used to create IDs.

Related

Trashed list or Custom list for trashed items

Is there a way to create a trash list?
Since I need to use soft deletes on my models I really need to create that list for the user restore tem items if he needs it.
I search in the docs but didn't found anything about it
You might try creating a View in your database that represents the soft deleted (trashed) rows. Then register a resource in your app for that view. You could actually UNION a number of tables together that had soft deleted rows in them as long as you could get some common columns from each table in your view.
After you had this view and tested it out, you could hook a to this view resource and let users view these deleted items. You could then connect an action to the List such that they could un-soft delete a given row.

Displaying a field in a column with a fallback option to another field

I'm creating a view for Contact entity and the issue is that some of their sellers have entered information on Mobile Phone field, while others used Business Phone field.
They'll probably continues to do so. There's no point copying the values as they're entered and both fields are needed.
The simplest solution is to display two columns in the view. However, that occupies the precious width on the form.
I wonder if it's possible to display a column in a view so that it gets its information from field Ahaa and if that happens to be empty, it falls back to displaying the field Buhu. Is it possible and if so - how?
There's no supported way to add conditional logic to a view definition such that it would show or hide columns. The usual way to do this is to store the value of whichever field is populated in third field. Populate this in a plugin and show this only in the view.

Windows 8 GridView - show two items per time

I need to implement a sort of book using the GridView Control.
In particular I'm looking for a way to display only 2 items per time and still to be able to scroll the whole list using scrollbars.
Your question isn't very clear, but I'm assuming you are asking how to ask 2 rows or columns of blocks to your application.
Have a look at the default new Metro app template. It's hub page has a multi-line gridview. The key is to use a WrapGrid, or VariableSizedWrapGrid to display your items. In the example, a gridview is used, but then the wrapgrid is used as the item template (used for each group of items).

Assigning a custom workflow to a work item type in Rational Team Concert

I'm in the process of customizing Rational Team Concert to include a custom work item type. As part of the testing of the work item type as I created it I populated a few of the custom work items with data. As I enhanced the custom work item type and added additional attributes I was able to use the "Check attributes usages in repository" from the "Types and Attributes" to ensure that the new attributes were propagated to my test work items.
Now I've gotten to the point where I need to create a custom workflow for this work item type. I've defined the workflow and and assigned it to the work item type, but my existing test work items can't seem to use it. Clicking on the "Check workflow usages in repository" link says "There are 9 work items in the repository referencing workflow states or resolutions that are not present in the bound workflow. Do you want to show these items in the Work Items view?".
The workitem view then just says that status = 1 for the test work items.
If I select a work to open in the rich client editor all of the process elements are inactive. If I open it in the web editor, it says that the status is "1", as shown below:
Is there any way to fix this and change the workflow of existing work items? I should add that new work items work just fine, but I'm worried about what might happen if I need to update the process again in the future.
In the context of work item customization, you have to manually sync existing work item attributes with the most recent version of the PA in order to take your changes into account.
The steps are detailed here in the manual page "Defining work item types and attributes":
(bottom of the page)
To manually update existing work items with new or modified custom attributes:
Run a query so that the query results contain all the work items that you want to update.
Note: Do not select any relationships to be shown in the query results.
If relationships are shown, the Type icon is not displayed and you cannot complete these steps.
To clear all relationships shown, in the Work Items view menu, select Relationships, click Deselect all, and then click OK.
In the Work Items view, select the work items that you want to modify.
In the row of one of the selected work items, right-click the Type icon and select Synchronize attributes.
Thanks.
Eric.

Winforms checkbox Databinding problem

In a winforms application (VB, VS2008 SP1) i bound a checkbox field to a SQL Server 2005 BIT field.
The databinding itself seems to work, there is this litte problem:
user creates a new record and checks the checkbox, then the user decides to create a new record (without having saved the previous, so there are 2 new records to be submitted) and checks also the second.
Now the user decides to save these records: the result is that only the second record keeps the checked value, the first one is unchecked! (i tried the same with 5 records: the result is the same, the first 4 records are unchecked and only the last one keeps the checked state).
What do i miss??
Thanks in advance
Sounds like a bug in winforms binding mechanism. There're more like these around (numericupdown, menu item checks bindings, etc).
You can probably workaround by registering an event on switching to another row, and manually read it from the UI and put into the table.