Extjs Grid, how do make last row unsortable? - extjs

Taking a look at the example at: http://dev.sencha.com/deploy/ext-4.0.0/examples/grid/locking-grid.html
The last row at the bottom is "wal-mart". How would I make that bottom row unsortable?
The way it is now, if I sort any column, Wal-mart may potentially move with the sort, and no longer be at the bottom. I want it to stay at the bottom, because I'm going to turn the bottom row into a "totals" row that will add up the values of all the rows above it, so it needs to stay at the bottom.

If the purpose of the row is to provide summary then you can use grid Summary feature and then you don't need to solve the problem of sorting.

Related

Fixed row in DevExtremeREACTIVE

Im using DevExtremeREACTIVE grid. Need to fix one row. As I understood from documentations its very easy for columns, but couldn't find anything for rows.
In the picture marked row should be fixed while user scrolling vertically.

Automatically resize form and move controls when new ones are added or a text in a label grows

Beginner in Visual Studio here.
I'm trying to create an C# Windows Form application that simply displays a form to show some information about the local system.
I have created this form with the help of the VS designer:
As you can see, it consists of a simple panel with a PictureBox at the top, a label below it (both centered), three table layouts next to each other, and a button at the bottom. Never mind the label texts.
The rows of all the table layouts are set to absolute, this is because I want to programatically add rows to the end middle and right table layout if there are more than one local IP address in the computer and setting the rows to auto size or percentage would make alignment difficult if more rows are added.
Now, my problem is that I can't figure out how to make the form resize and move the controls (specifically move the 'OK' button down) when more rows are added.
I have tried anchoring the button to the bottom edge of the form as well as the bottom of the middle table, both produce the same result: the button stays where it is and the new rows overlap it, like this
I would also like to know how to have the form resize to fit the contents of the labels. For example, if the text in one of the labels inside the layout is bigger than the column width, I'd like to have the form grow to accommodate it. Likewise, I'd like the form to shrink to fit the largest text.
I realize that this may not be the most efficient or easiest way to create this particular form, but it is what I've come up with, I of course welcome any suggestions in that regard. It is important to maintain alignment between the rows of all table layouts.
Thanks in advance.
Use a data grid and add controls to it if an add button is pressed. You can scroll through the rows so you won't need to adjust the height of the form

Grid index out of range on scrolling

i have this problem:
I needed to hide a row in a string grid so i simply did something like:
StringGrid.RowHeights[StringGrid.Row] := 0;
So this basicly sets the row height to 0 and it looks hidden. But after i do this and if i try to scroll i got a "Grid index out of range". If i click on another cell the error doesn't show up after i scroll. So it only shows when i hide it and then scroll directly after hiding a row.
Why does this happen and how can i fix it please?
You are not quite supposed to do that. Instead of making the heights 0 you can simply 'skip' putting the data in the rows you want to hide.
For example, your table is like this:
a b c
d e f
and you want to hide the second row, then you say: RowCount:= RowCount-1 and simply don't display the data in that row.
For this you need a procedure (let's call it RefreshData) which will show the data in the grid, will decide which data rows to show or not and will calculate how many rows the grid should have.
I had a problem where I'd get the grid index out of range error when attempting to modify colcount or rowcount on a stringgrid. I debugged the grid.pas and figured out the error was because I was accidentally setting the ColWidth property of the negative first column to -1 like ColWidth[-1] = -1. That had the effect of modifying some memory of an array that stores the list of widths of each column and the control would act as if the columns and rows did not exist when attempting to add more. Only putting this here because I searched all over the internet to find the answer and there was nothing so maybe someone else will make the same mistake.

Complex depth sorting issue based on MC location

I need help rescuing a project concerning some extreme depth management. We're out of ideas!
The project concerns stacking boxes of various sizes, each box is isometric - so thats where the depth comes in to play (we need to weave this box in front of that box, but on top of two boxes and below another, etc - anything goes!)
Here's the project as it stands:
http://clearlytrained.com/depth/
You can drag the boxes then let go over the grid if the grid space is green - if you were to take the two boxes that are one grid space high, place then next to eachother, then take a wider box (2x2) and place it over both (so the gap in the two lower boxes is in the middle of the box you placed on top) you'll see that the far right lower box's depth is now higher and above the box on top. I completley understand why this happens, but no matter how we sweep through the grid in order, this will happen to some extent the way it currently stands.
The way we're currently sorting depth, is sweeping through the grid array, which stores the name of every box on screen, based on the direction we sweep through the rows and columns we get an order to which we then set each box's depth. The problem is that even though a box might take up 6 grid spaces, we don't set the depth 6 times - we only set it the first time we come to its instance name in the array - so if we're sweeping through the grid bottom to top, left to right, a box that's physically under another box, yet further to the right will always have a higher depth. not good!
The only way i can see to fix this is to figure out some sort of box to box comparison of first X then Y values, setting up some sort of double for loop/if statemenet conditions, and more or less, programatically hand place each boxe's depth every time we move or place a new box. So the complexity goes from setting depth by order of box instance name, to comparing this box to every other box, then every other box to every other box, and coming up with the real order we need to stack their depth. In some cases we might go left to right, then bottom to top, then back to left to right - there's no smooth pattern.
Please play around with the link provided, let me know if you have any other questions or need more info, I'm desperate!
I would add all boxes to an array and sort that by both X and Y value (tile X and Y). It's not a large set, so you don't really have to worry about performance.
Sort by X, then if X is the same, sort by Y. That shoooould solve it, unless I missed something obvious.

Any 3rd party Table like controls for WPF?

I know about Grid. What I don't like about Grid is that I have to specifically index every single row and col. So afterwards, if I want to just move one row or col, I have to go update a ton of xaml.
I tried stackpanel and styles but then even this is a lot of redundant xaml and rearanging the screen still involves then removing/updating styles.
I really like how in an html table, I just start laying out my rows and cols on the fly. If I want to move a row, that's easy, I can just copy paste the xaml to the right spot, nothing else needs to get touched. A col, is a bit harder, but still can be done easily with cut/paste, just needs to be done to every row.
With grid, one may need to touch every single thing in it depending on what's moved.
And what would be really cool, is if one could declare the column width and row heights up above just like a grid. But then as need, provide override values in the actual row,col declaration down below that actually contains the gui elements.
Does anything like this exist?
I've seen implementation of a Grid that infers ColumnDefinitions from usage of attached properties. Its definately doable. You could create an attached property that signifies that this element is the last element of a row.
(See WrapBreakPanel in Pro Silverlight 4 in C# By Matthew MacDonald)
And what would be really cool, is if one could declare the column
width and row heights up above just like a grid. But then as need,
provide override values in the actual row,col declaration down below
that actually contains the gui elements.
Sounds like this could get confusing. What if multiple cells in a row override the height? You can pull this off already with Auto sizing a row and having elements take up more space as needed.

Resources