Jump to content

Problem with Grid refreshing .. please help !


alasoft

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...

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

Link to comment
Share on other sites

  • 11 months later...
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.
  • Upvote 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...