aristeo Posted June 28, 2013 Share Posted June 28, 2013 I need get the position of current row using JavaScript, not using Delphi. Anybody could help me? Thanks Quote Link to comment Share on other sites More sharing options...
bruno-pere Posted June 28, 2013 Share Posted June 28, 2013 Hi! In UniDBGrid.ClientEvents.ExtEvents: function OnCellclick(sender, rowIndex, columnIndex, e){ var me = MainForm.UniDBGrid1; pos = me.getSelectionModel().getCurrentPosition(); //alert(pos.column); ajaxRequest(MainForm.UniDBGrid1, 'CellChanged', ['col='+pos.column,'row='+pos.row]);} function OnKeypress(e){ var me = MainForm.UniDBGrid1; pos = me.getSelectionModel().getCurrentPosition(); //alert(pos.column); ajaxRequest(MainForm.UniDBGrid1, 'CellChanged', ['col='+pos.column,'row='+pos.row, 'charcode='+e.getCharCode()]);} Then, in the OnAjaxEvent, an example procedure to get the row and col: procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TStrings);var col, row, fld, key, val: string; c, r: integer;begin if EventName='CellChanged' then begin col := Params.Values['col']; row := Params.Values['row']; key := Params.Values['charcode']; UniLabel2.Caption := key; if (UpperCase(col)<>'UNDEFINED')and(UpperCase(row)<>'UNDEFINED') then begin UniLabel1.Text := 'Col: ' + col + ', Row: ' + row; c := strtoint(col); r := strtoint(row); fld := UniDBGrid1.Columns[c].Field.FieldName; UniLabel1.Text := UniLabel1.Text + ' - ' + fld + ' - ' + ClientDataset1.FieldByName(fld).AsString; end; end end; Bye! Bruno Quote Link to comment Share on other sites More sharing options...
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.