alasoft Posted July 10, 2012 Posted July 10, 2012 Hi everybody ! .. I'm making my first 'application' using Delphi+UniGUI, at first it seems impressive ! .. so, once again, congratulations Farshad ! Now I have a problem. I put some simple 'fast search' functionality, simply letting the user type some text, then when he press <enter> or some button .. begin the search the 'usual' way: with Table do begin First; while not Eof and UpperCase(LeftStr(FieldByName('description').AsString),Length(Search.Text)))<>UpperCase(Search.Text)) do Next; Grid.Refresh; end; This under these conditions: Grid.FetchAll=True, Grid.Paged=False. The row selected in the Grid ('Web version') corrresponds to the actual row in Table .. BUT if this new selected row was not in the 'current' page, the Grid doesn't refresh' the page, forcing the user to manually scroll to that page (where the row is actually selected) I look over the forum to find some answer to this .. but I only found 'have you tried Grid.refresh ?' .. yes I have. Okey, thanks a lot, everybody ! Robert Quote
alasoft Posted July 11, 2012 Author Posted July 11, 2012 Well .. :-) I finally found this: UniSession.AddJS('MainForm.Grid.getView().focusRow('+IntToStr(Query.RecNo-1)+')'); The point here is that Grid.getView().focusRow(n), force a page refresh, allowing to see the actual selected row in the grid. It's becoming more clear for me that some understanding of ExtJs is not just a 'plus' but some kind of need. Thank's everybody. Quote
vishwasshukla Posted October 10, 2012 Posted October 10, 2012 I tried this by putting this code on uniedit onchnage. On webmode it says that MainForm or Grid doesnot exists. Where should i use your code. Quote
alasoft Posted October 12, 2012 Author Posted October 12, 2012 I tried this by putting this code on uniedit onchnage. On webmode it says that MainForm or Grid doesnot exists. Where should i use your code. UniSession.AddJS('MainForm.Grid.getView().focusRow('+IntToStr(Query.RecNo-1)+')'); Here 'MainForm' or .. 'Grid' are just the names of components as you named it in plain Delphi, but it seems that ExtJS take exactly those names to operate over it's ExtJS counterpart. Put it simply, use the names you use in Delphi ('Form' or 'MyForm' or whatever) Regards Rober Quote
Sistema Fenix Posted October 5, 2013 Posted October 5, 2013 Roberto, Please, how do I add this command when the dbgrid is inside a frame and not the main form? Regards, Paulo Quote
Sherzod Posted October 7, 2013 Posted October 7, 2013 Hi Paulo Monteiro. If I understand the question, try this: ... uses UniGUIApplication ... Just use the property JSName UniSession.AddJS(MainForm.Grid.JSName+'.getView().focusRow('+IntToStr(Query.RecNo-1)+')'); Or UniSession.AddJS(YourGridName.JSName+'.getView().focusRow('+IntToStr(Query.RecNo-1)+')'); Or UniSession.AddJS(YourFrameName.YourGridName.JSName+'.getView().focusRow('+IntToStr(Query.RecNo-1)+')'); Sincerely. 1 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.