I need to save the default positions of the grid items on a button click.
I'm able to save and reload the grid items. but, after resetting the grid items, if I hit F5 it is taking me back to previous grid positions.
I want to save default positions on a click. please help.
thanks in advance.
// I'm not able to save the default grid positions after this line of code.
$grid.packery('reloadItems');
What you are looking for is the "stamp" option for Packery. From Packery's docs:
Packery will layout items around stamped elements.
The stamp option stamps elements only when the Packery instance is
first initialized. You can stamp additional elements afterwards with
the stamp method.
Have a look at this guide for more details and instructions.
Related
I have a ui grid that has 20 columns, and I would like to be able to tell what the next column will be as I scroll through the horizontal axis so that I can have some text that will tell the users what the names of all the columns they can't see are.
Anyone know if this is possible? As I watch the the inspector and scroll through the columns, I see html attributes changing.
---UPDATE 1----
This is what is all looks like (where it says "home #" is dynamic and will change to show the next column that is out of site)
Based on the ui-grid configuration that you use to render the grid, you already know the order of the columns. You can use this information together with the visible on each column added by the gird itself.
What you need to do is bind a event handler on scroll to iterate over the columns on each change and check the visibility of them. Then the first one with visible === false is the upcoming.
Here is a working Plunker where is used this flag.
Below is the design of my report.
When clicking the preview button, it shows one record every page.
How to make it display multiple records until the page is fully occupied, and then the next record will be on the next page? I want something like the image below.
Looks like you have set the StartNewPage property flag on your MasterData1.
Click that band with the righ button and uncheck the Start New Page of its Menu.
Instead of defining Report DataSet, define MasterData1 DataSet.
Right click on MasterData1, Edit... select the your DataSet and set the value of Number of Records to 0. Probably this property is set with 1.
I try to develop a selectMenu with image? I take exemple on jquery ui site and modify to add possibility to keep picture visible when you selected item with picture.
Here My code
My problem is on reset. Sometimes I need to put it in initial state.
I try refresh, but there is an automatic add of With on Span result and my select change size. I correct it on create event
widget.css({ 'width': '' });
But don't Work in select event... and when I click on reset my select become smaller.
Then I try destroy event. Good for the size but not for the text display. If I select an item with picture.
Click on reset
When I put break Point :
$(this).children(":first")
return the good item (text=TOUS") But it keeps old selected value to display text and display nothing
I don't know do to refresh correctly my selectmenu and return in first state
If debugging is the art of removing bugs ... then program is the art of creating
I'm using the latest version of Angular UI Grid and am struggling with how to determine if the focus is currently on the last displayed row of the grid.
The data array is not sorted the way it is on-screen, so I cannot use that info. I read that the visible row cache should be sorted as it is on-screen, but I think that might be related to the old ng-grid. At any rate, if I look at gridApi.core.getVisibleRows(myGrid) it still has the sorting as per the raw data.
I am currently handling the event gridApi.cellNav.on.navigate(newRowCol, oldRowCol). I can see the column and row that the user has the focus on, but I cannot see any values in this event (or elsewhere) that I can use to determine if the row is the last-displayed on-screen. I'd appreciate any tips!!
You should use gridApi.grid.renderContainers.body.visibleRowCache which is an array sorted the way the rows are visible on the screen. You can then check if the row is the last row with something like:
oldRowCol.row.uid == $scope.gridApi.grid.renderContainers.body.visibleRowCache[$scope.gridApi.grid.renderContainers.body.visibleRowCache.length-1].uid
I seem to have a mental block with this one.
I need to save recent changes to a Record. I am doing it OK with buttons for "New" "Edit" "Post" "Next" etc but when a user double-clicks a DBGrid, it is now too late to make changes as the DBGrid selection has moved the database cursor to the selected record.
I can't use AutoUpdate as the data that may have been changed is not something the user would have directly entered, it is a value that is changing all the time.
I'll try to describe it better: While the user is reading a Test-page, a timer is counting down or up. When they click the "Next" or "Prior" buttons I can save the timer setting. But, if they Double-Click the DBGrid I have no way of first changing the current Record before the selection moves to the clicked-Record.
I tried using the
Procedure TForm1.tblTestOnBeforeScroll(...
begin
tblTest.Edit;
tblTest.FieldByName('TimerCt').AsInteger:=ClockCtr;
tblTest.Post;
end;
But, that crashed the database, not surprisingly, but I thought I would give it a try before asking here.
How do I deal with the current record? I do not want to disallow the double-click if possible as it seems nice and intuitive for the user.
I'm afraid that what you do on DBGrid is a wrong in concept action.
Key point is DBGrid is a data aware control. So everything you do on it must based on it's datasource then it's dataset.
There is a DblClick event on TDBgrid. But still you have to check it's dataset to see what record is active.
The code you shown above clearly lead you to an endless loop.
When you doing a scroll, the dbgrid will call OnBeforeScroll event, moving the active record
and call OnAfterScroll. Your OnBeforeScroll code does an data update. Then dbgrid abort its operation cause of data change. Then after data update, it try to scroll again, and the data change happen again. Endless loop happen here.
best regard
Apologies in advance if I'm misunderstanding you, but it seems to me that either the premise of your question is wrong or there is something relevant you haven't told us about what you're doing. Please try the following:
If you don't have one already, please temporarily add a DBNavigator to your form and connect it to the same DataSource as your DBGrid. The point of doing this is so that you can more clearly see what's going on.
Then, in your DBGrid's Options, set dgEditing to True.
Finally, comment out or disable your BeforeScroll handler, save and run your program.
Now, click once in some cell in your DBGrid that contains a value which it's ok to change. Click it a second time so that it selects the value in the cell rather than the cell per se.
Make some change to the cell value, but do nothing else for the time being. You should notice that a) the current record indicator of the DBGrid has changed from a black triangle to an I-Beam graphic, like ][ and b) that the tick and cross buttons of the DBNavigator are now enabled.
Now, without doing anything else on the form, click in another row of the DBGrid. You should find that a) the change to what was the current record in step 5 has been saved and b) the current row indicator reverts to the black triangle and the DBNav's tick and cross buttons are disabled.
(If you don't get the behaviour I've just described, create a minimal new project and try that instead, as some other change you've made in your existing project may be interfering with it).
What I've described in 5 & 6 is the default behaviour of a DBGrid and insofar as I understand your q, that seems to be the behaviour you're trying to achieve. If that's not the behaviour you want, please explain exactly how what you do want differs. It's not clear to me where the user double-clicking on the grid comes into your q, except that that action may move the dataset's cursor (if the dbl-click is on a different row than the current one), but as the default DBGrid behaviour will save changes to the current row before it moves the dataset's cursor, it will do what you seem to want automatically.
Btw, what "AutoUpdate" do you mean? Did you mean TDataSource's AutoEdit property?