ShinobiGrid How to Merge Cells


#1

Is this Possible with Shinobi Grids?

TIA


#2

Hi Alex,

Unfortunately that’s not possible with the current version of Shinobi Grids. It may be something we might look into in future, but as of now it is not possible. One suggestion would to be overlay a UIView on top of your grid that you manage manually, or style your cells to make them look similar. Either approach is not ideal, and would require quite a bit of custom code, but that’s the only approach I can think of for now.

Thanks,
Chris


#3

Hi Mark thxs, I’m talking about the shinobi grid not charts.

I’m evaluating the controls especially cause I need to create an appointment book like the one we have in other system, this appt book will have rows that correspond to the time usually with 15 min interval and then columns that correspond to employees, then each cell is an appointment slot, now I can have an appt that is only 15 minutes and that shows 1 cell or have appts that span for 1 hour so should take 4 cells, now showing that same appt info that may not even fit in 1 cell 4 times is just not feasible.

If I was to overlay a view over those 4 cells is there a way to determine what is the top left positions of the 1st cell and the bottom right positions of the 4th cell, in relation to the screen?

is there any evets that will alert me when a user resises a column or a row, and also when they zoom in the grid?

TIA


#4

Hi Alex,

Apologies - I did mean grids not charts! I’ve edited my post above. Thanks for pointing that out.

A grid is basically a subclass of UIScrollView, so all of the methods available on UIScrollView are available on the grid too. You should be able to hook into the API of a scrollview to get the content offset. With regard to resizing columns, have a look at the Column Resizing Notifications section of the SGridDelegate API. Please note that we unfortunately won’t be able to support you with this if you do try to implement custom cells  -  as it’s not an official feature of Shinobi Grids.

An alternative option is to think about it from a different  angle. Instead of having merged cells, why not have split cells? I’m not 100% sure what you want to do here, but  could you split the cells that aren’t those you want to be merged? So the merged ones become “not split”. You’d need a special cell subclass that contains the split cells, and your datasource would need to have some special cases too. We think this is possible but we’re planing to do some investigation and we will create a tutorial or blog post if we find a good solution.

Regards,
Chris


#5

Hi, Chris, actually we need the grid to have the concept of column span (column group) to support reports for our company, let us know how likely it will be implemented?


#6

Hi Qiu,

Colspan and rowspan are definitely features that we will be implementing in future, but unfortunately I can’t give you a timescale or say when this is likely to be released.

Regards,
Chris


#7

Hi Chris,

Just 1 more question, 

Is there a way for me to find out the height of the next  x rows?
I.e. imaging that for example the cell i’m getting I want to simulate that the cell spans for 3 rows, can I get the height of the current row and also the height  f the next 2 rows so that I set the height of my UI view to that height?


#8

Hi Alex,

You could call the following method and add 1~x to the rowIndex.

-(SGridColRowStyle*)shinobiGrid:(ShinobiGrid*)grid styleForRowAtIndex:(int)rowIndex inSection:(int)sectionIndex;

Then get the “size” property of the result. That would give you the height for that particular row. This assumes that you’re using this method already and you are setting the size in it too.

Regards,
Chris


#9

Hi Chris,

I’m using Xamarin and I don’t see that method in ShinobiGrid.


#10

Hi,

Have a look here.

Regards,
Chris


#11

Hi Chris,

I saw that method already and i’m in fact using it, but I thought that this methos is used by the grid when it creates a row and request the style for that row, correct?

Bellow is the code I have on that method, so if I call it will be always creating new styles, also in’t possible to change the row size after the row was created?

protected override SGridColRowStyle GetRowStyle(ShinobiGrid grid, int rowIndex, int sectionIndex)
        {
            var style = new SGridColRowStyle()
            {
                MinimumSize = UIDevice.CurrentDevice.IsPhone() ? 30 : 60,
                Size = UIDevice.CurrentDevice.IsPhone() ? 50 : 100,
                TextAlignment = UITextAlignment.Center,
                TextVerticalAlignment = UIControlContentVerticalAlignment.Center,
            };
            if (rowIndex == 0)
            {
                style.MinimumSize = UIDevice.CurrentDevice.IsPhone() ? 100 : 200;
                style.Size = UIDevice.CurrentDevice.IsPhone() ? 150 : 300;
            }
            return style;
        }

#12

Any news on this?

TIA


#13

Hi Alex,

That’s correct - the grid does use that method, but there’s no reason that you can’t call it yourself.

If you’re worried about the method creating a new style object every time, why don’t you try to create the styles in the constructor? You could create two separate styles. One for the default cells and one for the cells at row 0. Then if you have them as instance variables you can simply return them from this method and it won’t have to create a new style every time.

Regards,
Chris