SwiftUI ForEach DisclosureGroup .onDelete = Index out of range - list

Remove subitems work good, but remove item give me present:
"Swift/ContiguousArrayBuffer.swift:575: Fatal error: Index out of range"
Plz help! =)
App view
Code
Create data code

Related

SwiftUI TextField freezes when deleting first character

When specifying a minimumScaleFactor for a TextField in SwiftUI the TextField behaves normally while you enter text and reduces the font as specified when the content does not fit the TextView. However, if you start deleting characters everything works as usual until you delete the first character. Everything freezes.
At the beginning I though it was something in the way I was handling the variable that stores the text that in my application I have it as an ObservedObject. However, after debugging the frozen app I noticed that the code was circling around the drawing of the TextField over and over, function after function everything pointed to an error in the drawing of the object on the screen.
The following code illustrates the issue. The TextField works perfectly when you enter characters and delete them until you get to the first one. The it freezes.
import SwiftUI
struct ContentView: View {
#State var sensorNumber: String = ""
var body: some View {
TextField("WC0.000.000.000", text: $sensorNumber)
.padding(.all, 5.0)
.font(Font.custom("Helvetica", size:40.0))
.minimumScaleFactor(0.90)
}
}
The problem seems to be related to the interaction of the Custom Font. Obviously, my application is using custom fonts but here I just wanted to simplify the code.
This code does not fail if you don't use a custom font or if you don't specify a minimumScaleFactor. I have found a workaround that is not very elegant but it works until Apple fixes this bug:
import SwiftUI
struct ContentView: View {
#State var sensorNumber: String = ""
var body: some View {
TextField("WC0.000.000.000", text: $sensorNumber)
.padding(.all, 5.0)
.font(Font.custom("Helvetica", size:40.0))
.minimumScaleFactor(sensorNumber.count < 2 ? 1.0 : 0.90)
}
}
I am submitting a radar to Apple but looking for a better solution for the problem here.

Orchard container without creating list tags

I am using Orchard to create a table-like layout. I have defined two content types: 'Row' and 'Column'. To allow items of the type Column to be added to a Row I added the 'Container' part to the Row and 'Containable' to the Column.
All works fine, the columns show up in the row they were put in, however Orchard renders list tags around my columns which mess up my layout. Is it possible to prevent these list tags from being rendered? I checked out the source of ContainerPartDriver.cs but the 'listShape' seems to be baked in, however I hope someone can prove me wrong.
For now I am retrieving the container items and displaying each one in the view itself.
#{
var contentManager = WorkContext.Resolve<IContentManager>(); ;
var container = (ContentItem)Model.ContentItem;
var query = contentManager
.Query(VersionOptions.Published)
.Join<CommonPartRecord>().Where(x => x.Container.Id == container.Id)
.Join<ContainablePartRecord>().OrderByDescending(x => x.Position);
}
#foreach (var item in query.List())
{
#Display(contentManager.BuildDisplay(item, "Detail"));
}

how to know if grid or list view is active with custom magento page

I have a custom product list page and i´m using the following code to show the pagenumbering and filters:
$pager = $this->getLayout()->createBlock('page/html_pager');
echo $this->getLayout()->createBlock('catalog/product_list_toolbar')->setChild('product_list_toolbar_pager', $pager)->setCollection($products)->toHtml();
If i'm changing the mode from grid to list view nothing happens.
How can i get the active mode (grid or list).
Magento normaly uses $this->getMode() but this one doesnt work.
I have fixed it with the following code:
$mode = $this->getLayout()->createBlock('catalog/product_list_toolbar')->setChild('product_list_toolbar_pager', $pager)->getCurrentMode();
Another solution,
if(Mage::getSingleton('catalog/session')->getDisplayMode())
{
$productListMode=Mage::getSingleton('catalog/session')->getDisplayMode();
}

xcode view collection cell wrong size

I have a custom collection cell nib that has the size w:160 h:146. When i populate my collection view, all the elements are extremely small, like 20px * 20px.
Why does it decrease the size of my cells ? This is my code
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)IndexPath
{
static NSString *CellIdentifier = #"Cell1";
[collectionView registerNib:[UINib nibWithNibName:#"TjansterCell" bundle:nil] forCellWithReuseIdentifier:#"Cell1"];
TjansterCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:IndexPath];
return cell;
}
The issue is that the collection view flow layout is using the default size for its 'itemSize' property. Fortunately, this is easy to fix. Simply add the following code to your collection view's delegate:
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return CGSizeMake(<your width>, <your height>);
}
I had the same problem where my custom size remained the standard size when I ran the app. Therefore, to solve this problem I found by manually resizing the cell in storyboard first and then entering or re-entered the custom sizes in the size inspector solved this buggy problem.
Also, I found that when you select the collection view in storyboard and select the size inspector. Here you enter the correct dimensions under Collection View Size and enter the dimensions in the Cell size text fields. This is the important part.

How to dynamically change the list data when click on picker 'done' button in Sencha Touch

I am developing my application in Sencha touch. In that I have a list and Picker and I want to update the list data dynamically when selecting the picker i.e., I want to add data to list dynamically when tap on 'Done' button of Picker. I used some logic for this but this doesn't update the list content.
listeners: {
change: function(picker,value) {
textValue = picker.getValue()['name'];
var me = this,
nameList = this.down('#namesList');
nameList.add({fullname:textValue}) ;
}
}
When I update like this, it throws me the error that 'Uncaught TypeError: Cannot call method 'add' of null' eventhough 'namesList' is already defined. Please show me the way to solve this problem.
I would add a record to the data/store of the list, and then capture the list and refresh.
The issue there is that nameList isnt actually the list component.
Try adding for example an id to the list, and then in the picker change listener:
Ext.getCmp('mylist-id').refresh()
Hope it helps.