molla2005b Posted January 28, 2017 Posted January 28, 2017 function cellkeydown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) { if (e.getKey() == 40) { if (rowIndex==Last Row) <---- problem { e.stopEvent (); ajaxRequest(sender, 'AppendRow', [] ); } } } this is my code. tnx Quote
Sherzod Posted January 29, 2017 Posted January 29, 2017 Hi, Can you analyze this post?!: http://forums.unigui.com/index.php?/topic/6869-unidbgrid/ Best regards. Quote
molla2005b Posted January 29, 2017 Author Posted January 29, 2017 hi . it is usefull post.thanks I use vk_down and Tab I'm use tab key to fill columns data. I want to append a new record when tab key reach Last Column of last row and user press Tab again to append new record Best regards. Quote
Sherzod Posted January 30, 2017 Posted January 30, 2017 Hi, You can try like this: 1. type TUniExDBGrid = class(TUniDBGrid) end; 2. procedure TMainForm.UniDBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var isLastRecord: Boolean; begin isLastRecord := (Sender as TUniDBGrid).DataSource.DataSet.RecNo = (Sender as TUniDBGrid).DataSource.DataSet.RecordCount; if (Key = VK_TAB)and(isLastRecord)and(TUniExDBGrid(Sender).CurrCol=(Sender as TUniDBGrid).Columns.Count-1) then begin // your logic (Sender as TUniDBGrid).DataSource.DataSet.Append; end; end; Best regards. Quote
kentiger Posted May 6, 2021 Posted May 6, 2021 Ver: 1.90.0.1547 Trial I follow the Sherzod method Error Message: TuniCustomDBgrid.SetCellValue: RecNo Mismatch![4: -1]. Please help, thank you Quote
Hayri ASLAN Posted May 6, 2021 Posted May 6, 2021 5 hours ago, kentiger said: Ver: 1.90.0.1547 Trial I follow the Sherzod method Error Message: TuniCustomDBgrid.SetCellValue: RecNo Mismatch![4: -1]. Please help, thank you Hello Can you please create a test case? Quote
eduardosuruagy Posted May 6, 2021 Posted May 6, 2021 This error is old and they have never been able to correct it. Quote
Hayri ASLAN Posted May 6, 2021 Posted May 6, 2021 6 minutes ago, eduardosuruagy said: This error is old and they have never been able to correct it. Hello This error happens when you make changes when grid is dirty. There is no way to fix this error as you need to change your code. This error is a precaution. Quote
eduardosuruagy Posted May 6, 2021 Posted May 6, 2021 1 hour ago, Hayri ASLAN said: Hello This error happens when you make changes when grid is dirty. There is no way to fix this error as you need to change your code. This error is a precaution. Sorry, I didn't understand the translation of what would be "grid is dirty" Quote
Hayri ASLAN Posted May 6, 2021 Posted May 6, 2021 14 minutes ago, eduardosuruagy said: Sorry, I didn't understand the translation of what would be "grid is dirty" Hello If grid needs to refresh itself, that means grid is dirty. Let say you have 3 records and in server side you refreshed the query and you have 4 records now. In the client side grid needs to refresh. Before it refresh if you try to access 4th record in client side, you will get error. Quote
eduardosuruagy Posted May 6, 2021 Posted May 6, 2021 2 hours ago, Hayri ASLAN said: Olá Se a grade precisa se atualizar, isso significa que a grade está suja. Digamos que você tenha 3 registros e no lado do servidor você atualizou a consulta e agora tem 4 registros. Na grade do lado do cliente precisa ser atualizada. Antes de atualizar, se você tentar acessar o 4º registro no lado do cliente, obterá um erro. can you show me an example? I do a lot this way, I don't know if it's correct. DataSet.Edit; DataSet.FieldByName ('FIELD'). AsString: = 'Value'; DataSet.Post; DataSet.ApplyUpdate (0); DataSet.RefreshRecord; dbgrid.RefreshCurrentRow (); Quote
kentiger Posted May 7, 2021 Posted May 7, 2021 Hi, Hayri ASLAN UniDbgrid1 have 3 Column badno badname description My needs: When in the add mode, after the user enters the data in the Description, press the down button, the system automatically Append new record The following is my program procedure TMainForm.UniDBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var isLastRecord: Boolean; begin isLastRecord := Abs((Sender as TUniDBGrid).DataSource.DataSet.RecNo) = (Sender as TUniDBGrid).DataSource.DataSet.RecordCount; if (Key = VK_DOWN) and (isLastRecord) and(TUniDBGrid(Sender).CurrCol=(Sender as TUniDBGrid).Columns.Count-1) then begin (Sender as TUniDBGrid).DataSource.DataSet.Append; end; end; An error message will occur as follows-->TuniCustomDBgrid.SetCellValue: RecNo Mismatch![4: -1]. Please help, thank you Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.