Search the Community
Showing results for tags 'UniDbGrid'.
-
Save and restore the order and width of columns in UnidbGrid These functions can be used in forms If the form contains a grid, just pass the grid and leave the second parameter empty If the form contains multiple grids, you can also pass a second word in the second parameter in addition to the grid Virtual table (kind of memory tables) tables are used for saving and retrieving, but you can use JSON or XML Procedure TDMT.SaveGrids_SaveGridLayout(Grid: TUniDBGrid; Const KeyAlt: String = ''); Var i: Integer; vt: TVirtualTable; Begin If Not Assigned(Grid) Then Exit; Grid.Refresh; vt := VTGridLayouts; // حذف قبلی Try SaveGrids_DeleteGridLayout(Grid, KeyAlt); // ذخیره جدید For i := 0 To Grid.Columns.Count - 1 Do Begin vt.Insert; vt.FieldByName('GridKey') .AsString := Grid.Parent.Name + '_' + Grid.Name; vt.FieldByName('GridKeyAlt') .AsString := KeyAlt; vt.FieldByName('FieldName') .AsString := Grid.Columns[i].FieldName; vt.FieldByName('ColIndex') .AsInteger := Grid.Columns[i].Index; vt.FieldByName('ColWidth') .AsInteger := IfThen(Grid.Columns[i].Width>150,Grid.Columns[i].Width,150); vt.Post; End; Finally SaveGrids_SaveToFile; End; End; Procedure TDMT.SaveGrids_LoadGridLayout(Grid: TUniDBGrid; Const KeyAlt: String = ''); Var i: Integer; vt: TVirtualTable; EffectiveKey, FieldName: String; Begin If Not Assigned(Grid) Then Exit; vt := VTGridLayouts; EffectiveKey := IfThen(KeyAlt <> '', KeyAlt, Grid.Parent.Name + '_' + Grid.Name); vt.Filtered:=False; Vt.Filter:='(GridKeyAlt='+ QuotedStr(KeyAlt)+') Or (GridKey='+QuotedStr(Grid.Parent.Name + '_' + Grid.Name)+' And GridKeyAlt ='+ QuotedStr('')+')'; vt.Filtered:=True; For i := 0 To Grid.Columns.Count - 1 Do Begin FieldName := Grid.Columns[i].FieldName; vt.First; If Vt.Locate('FieldName',FieldName,[]) Then Begin Grid.Columns[i].Flex := 0; Grid.Columns[i].Index := vt.FieldByName('ColIndex').AsInteger; Grid.Columns[i].MinWidth := 100; Grid.Columns[i].Width := vt.FieldByName('ColWidth').AsInteger; End; End; End; Procedure TDMT.SaveGrids_DeleteGridLayout(Grid: TUniDBGrid; Const KeyAlt: String = ''); Var vt: TVirtualTable; Begin If Not Assigned(Grid) Then Exit; vt := VTGridLayouts; vt.Filtered := False; vt.Filter := '(GridKeyAlt=' + QuotedStr(KeyAlt) + ') Or (GridKey=' + QuotedStr(Grid.Parent.Name + '_' + Grid.Name) + ' And GridKeyAlt =' + QuotedStr('') + ')'; vt.Filtered := True; vt.First; While Not vt.IsEmpty Do vt.Delete; vt.Filtered := False; End; procedure TDMT.SaveGrids_SaveToFile; begin VTGridLayouts.SaveToFile(CurrentPath + '\GridLayouts.xml'); end; procedure TDMT.SaveGrids_LoadFromFile; begin if FileExists(CurrentPath + '\GridLayouts.xml') then VTGridLayouts.LoadFromFile(CurrentPath + '\GridLayouts.xml'); VTGridLayouts.Open; end;
- 7 replies
-
- 2
-
-
- unidbgrid
- virtualtable
- (and 4 more)
-
В отдельной ветке к старому вопросу мне так никто и не ответил, поэтому создал новую тему: Сама ветка: Как заставить UniDBGrid показывать вместо нулевой даты типа 30/12/1899 просто пустое значение. Смысл задачи простой, есть FDQuery, который подключен к базе MS SQL. Внутри базы есть табличка в которой есть поля с типом datetime. Они non nullable. Но нужно в эти поля занести дату со значением 0. q_timebegin_time.AsDateTime := 0; После этого UniDBGrid начинает показывать время 30/12/1899 00:00:00. Как убрать это время, чтобы оно было пустым в ячейке? Нужно просто визуально скрыть эту дату пока она не будет нормальной. Использование ИИ дало вот такой вариант, но он работает очень долго, если записей будет хотя бы 50-т и больше. grid_afterrender(grid, eOpts) { var store = grid.getStore(); function cleanDates(records) { var changed = false; records.forEach(function(rec) { for (var fieldName in rec.data) { if (rec.data.hasOwnProperty(fieldName)) { var v = rec.get(fieldName); if (v === 0 || v === '0' || v === null || v === undefined || v === '' || String(v).includes('1900') || String(v).includes('1899')) { rec.set(fieldName, null); changed = true; } } } }); // Обновляем только если реально были изменения if (changed) { setTimeout(() => grid.getView().refresh(), 0); } } // при добавлении новой записи store.on('add', function(s, records) { cleanDates(records); }); // при загрузке данных с сервера store.on('load', function(s, records) { console.log('🟢 Store load'); cleanDates(records); }); // при любых изменениях (после Post и т.п.) store.on('datachanged', function(s) { console.log('🟣 Store datachanged'); // ⚠️ refresh не вызываем напрямую здесь — только чистим cleanDates(s.getRange()); }); } Если использовать GetText на поле FDQuery, то будет вот такой результат: Ajax error Unexpected token ',' O396.setDisabled(false);O39A.setDisabled(false);O45C.show();O45C.show();O45C.show();O45C.show();O45C.show();O45C.show();O45C.show();O45C.show();O45C.show();O45C.show();O392.setDisabled(false);_gsc_(O2AE);O2A7.uniInsert(0,{"id":2147483647,"0":9374368,"_0":"{b:'#F0F0F0'}","1":"2","_1":"{b:'#F0F0F0'}","2":"21.10.2025 14:46:20","_2":"{b:'#F0F0F0'}","3":"01.01.1900 00:00:00","_3":"{b:'#F0F0F0'}","4":"","_4":"{b:'#F0F0F0'}","5":"","_5":"{b:'#F0F0F0'}","6":"01.01.1900 00:00:00","_6":"{b:'#F0F0F0'}","7":"01.01.1900 00:00:00","_7":"{b:'#F0F0F0'}","8":"01.01.1900 00:00:00","_8":"{b:'#F0F0F0'}","_x":1,"_r":-1});_gsc_(O2AE,0,0);O2C2.stateValue="-1";_gsc_(O37E);O377.uniInsert(1,{"id":2147483647,"0":9374368,"_0":"","1":"2","_1":"","2":"21.10.2025 14:46:20","_2":"","3":"","_3":"","4":,"_4":{a:"",d:""},"5":"01.01.1900 00:00:00","_5":"","6":"01.01.1900 00:00:00","_6":"","7":"01.01.1900 00:00:00","_7":"","8":"","_8":"","9":"","_9":"","10":"","_10":"","11":"01.01.1900 00:00:00","_11":"","_x":1,"_r":-1});_cgms_(O373);_gsc_(O37E,1,3);_sge_(O373,1,3,false);O3A2.load({params:{options:1}});O3B9.stateValue="-1";O3C5.stateValue="-1";
-
The problem I encountered when displaying livestock data is that: The field descriptions (column headers) do not align with the values displayed in the same column. In fact, it seems that the field values do not match their headers and the data is shifted or displayed in the wrong column. Fields like "Gender", "Gender Code", "Serial", "Date of Birth" and... are in a row but their values seem to be shifted in between. Some columns have a value of zero but it is not clear whether that zero is related to the code or the text. All the records are similar but the table UI is not reliable because the display order is messed up. Has anyone had a similar experience in UNIGUI? Could this be due to the Columns, DataField, Alignment, or GridOptions settings? Does anyone have any suggestions for ensuring that the field matches the correct column in TUniDBGrid? I would appreciate your advice on where this problem comes from and how to fix it. uni-1.95.0.1592 Delphi 11
-
In this topic , I try to share some css for you . For dear novices I will explain, you have this code in UniServerModule -- > CustomCSS Copy and assign the object to the CLS section in Layoutconfig when designing, or use this command when executing bitbtn1.JSCall('addCls', [' ...... ']); you can do if you like first, this sites can help to build css runtime https://htmlcheatsheet.com/css/
-
Hello, I need to create a ToolButton in a TuniDBGrid at runtime, I'm trying to create it as follows: UniDBGrid1.ToolButtons.Add; UniDBGrid1.ToolButtons.Items[UniDBGrid1.ToolButtons.Count - 1].IconCls := 'delete'; UniDBGrid1.ToolButtons.Items[UniDBGrid1.ToolButtons.Count - 1].ButtonId := 1; UniDBGrid1.ToolButtons.Items[UniDBGrid1.ToolButtons.Count - 1].Visible := true; I have already checked with "count" if the button was created and the count indicated that it was, but it does not appear, I tried "refresh" and "repaint" but nothing happens, can someone help me? uniGui version: 1.95.0 build 1595 Delphi version: 12.2 Patch 1
-
The uniDBGrid is fairly good. But i notice that if the ADO dataset contains lots of records (like 30,000) then it becomes horribly slow. I do NOT have calculated fields. I do NOT use client cursor location (i use serverside cursor to my SQL database) I use the PAGED web option so that only a few records are displayed at a time. My page size is 4 records. My VCL program that uses TDBGrid loads the grid in about 4 seconds. The similar web version that uses TuniDBGrid loads in about 50 seconds. That's a huge difference. Is there an explanation? Thanks Davie
-
Hello, Does any one face the following issue to Activate UniDBGrid.ColumnSummary or ColumnSummaryResult As Soon As Column value changed. I need the Total to be changed Directly without changing the Record, Is it Possible ? Thanks in Advance Untitled video.mp4
- 11 replies
-
- unidbgrid
- columnsummary
-
(and 1 more)
Tagged with:
-
Hello, I have an issue of UniDBGrid when RTL is True, the data of Column 0 does not appear how it should be, This problem appeared on customer PC's, but not on all PC's, only on some in spite of the same configurations of the PC's same Chrome and Edge versions But in FireFox it worked without problem. Client PC's is Windows 11 and Windows 10 Here am attaching the behavior and a sample project. am using the latest version 1.95.0.1583 and Delphi 11.3 Regards to All TestRTLUniDbGrid.rar
-
Dear all, I am using unidbgrid for my project. I am manage to set for 1 group in my dbgrid with summary, but my project need multi group and summary with grand total of the parent group. what we want is like this table A AB W1 500 TOTAL QTY :500 A AB W2 400 TOTAL QTY :400 TOTAL QTY : 900 A AC W1 100 TOTAL QTY :100 A AC W2 200 TOTAL QTY :200 TOTAL QTY : 300 TOTAL QTY : 1200 Can give me advise ?
-
DBGrid just decides to scroll the FOCUSED cell into view for a grid with more rows than can be displayed at once. EVEN THOUGH i had scrolled the vertical scroll bar so that the FOCUSED row has been scrolled out of view. Go to your demo on the uniGUI.COM website then pick desktop demo then open up the "Grids" tree section of the demo then pick "Cell Editors". Doesn't really matter which example you pick. I picked cell editors because it has LOTS of rows (more than are visible). That is the key. Now, in order to replicate the problem/bug/annoyance, follow these steps... 1. CLICK/FOCUS a cell on the top row (could be any row) 2. Scroll grid so that that top row scrolls up and out of view. Scroll with mouse wheel OR the VERTICAL scroll bar. BE VERY CAREFUL NOT TO CLICK ANYWHERE ELSE ON THE FORM cause that cell you focused in step 1 will lose focus. We don't want the cell to lose FOCUS. 3. Click once on your desktop(windows) so that the browser loses focus. Don't worry if you click on an icon since you are not double-clicking. If you have many programs running at once, i suppose you could click on NOTEPAD too. Doesn't matter, we just need the browser to LOSE FOCUS. 4. Now be careful to click on the browser (but not inside the displayed web page. If you click in the red area, you will be safe. It's unused space on the title bar of most browsers. You will notice that the cell you FOCUSED on step 1 has now SCROLLED BACK INTO VIEW. NOTE: This auto scrolling occurs in a variety of other ways too. It's not just defocusing the browser and then refocusing the browser. TO me that seems bad and dumb, because I didn't tell the grid to change my vertical positioning. I hope this is an issue with unigui and not the sencha stuff. Thanks DAvie
-
Hello there. I have been struggling with this for days and have searched everywhere on the form. I want my enter key to move focus to the cell below it (next row) and immediately start editing it (almost like Excel). At this moment, when I press enter, it goes to the cell below but doesn't open the cell for editing. So I have to tap enter again. I just want to tap enter once, then move down, edit and tap enter again. I am using Delphi 10.2 and UniGUI 1.90.0 build 1566. Thanks for your assistance.
-
Hi After ticking each of the selected cells in Test Case, the horizontal scroll will jump. Rtl = True. Regards. GridCheckSelectOnly.zip
-
Hi, I want to select all rows and deselect all rows on one button click, Is that any property is exist for TUniDBGrid or not for do this? or need to write code manually selecting all rows and deselecting all rows?
-
Hola, tengo un problema con 2 UniDbGrid relacionados con Maestro/Detalle. Agrupo los datos por un campo de la UniDbGrid y empieza el problema. El problema es que si me desplazo con el teclado (por ejemplo, presiono y mantengo presionado hacia arriba/abajo, la cuadrícula de detalles no puede mantenerse al día con las actualizaciones y las paradas. Solo funcionan los clics del mouse. Estoy usando el evento afterscroll para actualizar la cuadrícula de detalles, pero si me desplazo hacia arriba y hacia abajo varias veces, el afterscroll simplemente deja de funcionar. procedure TUM.qConPedidoAfterScroll(DataSet: TDataSet); var id:integer; begin id := Dataset.fieldbyname('id').asinteger; qdetalle.Close; qdetalle.ParamByName('IDPEDIDOS').AsInteger:=Id; qdetalle.Open; end; ¿Puede darme una solución con alguna funcionalidad en DBGrid, o quizás pueda recomendar una solución alternativa? Actualizar master-detail no es un problema en el escritorio, pero en la web es completamente diferente. Gracias.
- 1 reply
-
- afterscroll
- unidbgrid
-
(and 1 more)
Tagged with:
-
-
Can anyone explain why (or what would cause) UniDBGrid.RecordCount event to be called several times upon the creation and initial display of a form? In fact, it's called approximately 6 times before the form finishing loading. Even weirder, it appears to be called even before the table has even been opened, based on my logging snippet below: [2 µs][Trace][Value: TframeItem.UniFrameCreate][Type: string] [1040 µs][Trace][Value: TframeItem.UniFrameBeforeReady][Type: string] [25689 µs][Trace][Value: TframeItem.UniFrameReady | begin][Type: string] [29 µs][Trace][Value: TframeItem.tblItem_BeforeOpen][Type: string] [5420560 µs][Trace][Value: TframeItem.UniDBGrid1RecordCount][Type: string] [1876286 µs][Trace][Value: TframeItem.UniDBGrid1RecordCount][Type: string] [18 µs][Trace][Value: TframeItem.UniDBGrid1RecordCount][Type: string] [1196 µs][Trace][Value: TframeItem.tblItem_AfterOpen][Type: string] [2 µs][Trace][Value: TframeItem.tblItem_AfterScroll | begin][Type: string] Thanks in advance.
-
Hi, Currently any colour changes in the grid are not reflected on the export. I need to be able to persist either cell colour or text colour when exporting from a grid to make cells visually clear. Like the image below: I can get the cells to change to the respective colour on the grid within the application, what I'm looking for is a way to persist these cell colours when exporting. I am currently using the UniGridExcelExporter component calling grid.Exporter.ExportGrid; to export. Any help would be great. Regards, Wicket
-
@Sherzod доброе время суток. Заметил странное поведение грида, после того как уничтожаешь объект Edit, который является редактором фильтра в столбце, столбец исчезает. Срабатывает событие "onColumnHide" testGrid.zip Суть в том, что я запоминаю действия над столбцами и записываю в конфиг. При последующем построении грида, настройки столбцов считываются с этого конфига. Получается так, что при каждом перестроении грида, у меня не произвольно пропадают столбцы
-
I know drag&drop using two UniDBGrids are discussed and there are even demo about it but how about dragging and dropping inside one grid? I have data in which rows are ordered by indexed row number and I'd like to add feature where user can drag rows to different positions and when user does that, row numbers are updated in the background accordingly. What is the easiest and more importantly, correct way to achieve this?
-
Hey guys. Is there any way to add a jpg/png image to the Title of a UniDBGrid column? For this specific case, FontAwesome does not work, it needs to be an image that can be loaded or drawn. I've already researched a lot but I didn't find it (maybe I went the wrong way in the searches). Thanks in advance for any help.
- 1 reply
-
- unidbgrid
- column title
-
(and 1 more)
Tagged with:
-
Hello, how are you guys? How do I define a CustomCSS in UniDBGrid.HeaderTitle. I was able to do it in the rest of the UniDBGrid, but the HeaderTitle property does not apply, how could I do it ??
- 3 replies
-
- headertitle
- unidbgrid.headertitle
-
(and 3 more)
Tagged with:
-
Hi all, how to prevent numeric field in Unidbgrid cell from changing value with navigation keys (up, down). If we press key up current cell value increased by 1 one, if we press key down value decreased by 1. I would like that navigation key go to next/previous row on grid, without changing the value ... similar to Excel. br, Marko
