Code Monkey home page Code Monkey logo

Comments (5)

danielctull avatar danielctull commented on September 24, 2024

Has this just happened with the last version that was pushed or did the problem occur in previous versions? Cheers.

from dtgridview.

jfmorin avatar jfmorin commented on September 24, 2024

Hi,
I'm using the latest code version.

I also noticed that I can reloadData without problem when going from 1 row of multiple columns (horizontal) to 1 column of multiple rows (vertical) but an exception is thrown when going the other way.

* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableArray objectAtIndex:]: index 1 beyond bounds [0 .. 0]'

The problem is at:

  • (void)checkViews {
    ...
    // Line 446
    if ([[self.gridCells objectAtIndex:info.yPosition] count] - 1 > info.xPosition && info.frame.origin.x + info.frame.size.width < self.contentOffset.x + self.frame.size.width)
    ...
    }
    Jeff

from dtgridview.

eric-w avatar eric-w commented on September 24, 2024

Ran into this also with the latest version. A simple fix that seems to work is to add the line [cellInfoForCellsOnScreen removeAllObjects]; to initializeViews at line 534 just after the first for loop. See below:
- (void)initialiseViews {

    for (NSInteger i = 0; i < [cellInfoForCellsOnScreen count]; i++) {
        DTGridViewCellInfo *info = [cellInfoForCellsOnScreen objectAtIndex:i];
        if (![self cellInfoShouldBeOnShow:info])
        [self removeCellWithInfo:info];
    }
    //Eric fix for issue with rotation of DTGridView to a table with a different number of rows or columns.
    //Not sure if this should be the final fix, but it is working for now.
    [cellInfoForCellsOnScreen removeAllObjects];

    for (NSInteger i = 0; i < [gridCells count]; i++) {

from dtgridview.

quimarche avatar quimarche commented on September 24, 2024

I worked around this by adding a range check:

    } else if (isGoingRight) {
        // check bounds
        if (info.yPosition < [self.gridCells count])
        {
            if ([[self.gridCells objectAtIndex:info.yPosition] count] - 1 > info.xPosition && info.frame.origin.x + info.frame.size.width < self.contentOffset.x + self.frame.size.width) {
                if (![leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]])
                    [leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
                else if ([[leftRightCells objectForKey:[NSString stringWithFormat:@"%i", info.yPosition]] xPosition] < info.xPosition)
                    [leftRightCells setObject:info forKey:[NSString stringWithFormat:@"%i", info.yPosition]];
            }                
        }
    }

from dtgridview.

apike avatar apike commented on September 24, 2024

This happens for me as well on the current version - it happens when you remove a column, but not when you add one. Any thoughts on what makes for a performant workaround?

from dtgridview.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.