alasoft Posted July 10, 2012 Share 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 Link to comment Share on other sites More sharing options...
alasoft Posted July 11, 2012 Author Share 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 Link to comment Share on other sites More sharing options...
vishwasshukla Posted October 10, 2012 Share 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 Link to comment Share on other sites More sharing options...
alasoft Posted October 12, 2012 Author Share 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 Link to comment Share on other sites More sharing options...
Sistema Fenix Posted October 5, 2013 Share 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 Link to comment Share on other sites More sharing options...
Sherzod Posted October 7, 2013 Share 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 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.