Jump to content

Recommended Posts

Posted

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

Posted

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.

  • 2 months later...
Posted

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

  • 11 months later...
Posted
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...