Jump to content

uniDBGrid1 - select all - with checkboxes


erich.wanker

Recommended Posts

after filtering a table - i want to select all records 

 

why does this not work?

procedure Tkunden_fakturieren.DSTRUKTUR1DataChange(Sender: TObject;
  Field: TField);
begin
    liste.SQL.Clear;
    liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR  = '+STRUKTUR1.FieldByName('INR').asstring+' ORDER BY VERTRAG_NR desc ');
    liste.Open;

    UniDBGrid1.JSInterface.JSCall('getSelectionModel().selectAll', []);

   // i also tryed: 

   UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();');


end;

..  just the focused record has a checked Checkbox 

 

 

Thanx for Help

 

Link to comment
Share on other sites

Maybe you should try this approach for now:

1.

  
  YourGrid.JSInterface.JSAssign('needToSelectAll', [True]); //<---------
  liste.SQL.Clear;
  liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR  = '+STRUKTUR1.FieldByName('INR').asstring+' ORDER BY VERTRAG_NR desc ');
  liste.Open;

2.

YourGrid -> ClientEvents -> ExtEvents -> function store.load // or use the OnAfterLoad event of your Grid with some conditions

function store.load(sender, records, successful, operation, eOpts)
{
    if (sender.grid.needToSelectAll) {
        Ext.defer(function () {
            sender.grid.getSelectionModel().selectAll()
        }, 100);
    }
}

 

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
On 10/30/2018 at 1:48 PM, Sherzod said:

Maybe you should try this approach for now:

1.


  
  YourGrid.JSInterface.JSAssign('needToSelectAll', [True]); //<---------
  liste.SQL.Clear;
  liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR  = '+STRUKTUR1.FieldByName('INR').asstring+' ORDER BY VERTRAG_NR desc ');
  liste.Open;

2.

YourGrid -> ClientEvents -> ExtEvents -> function store.load // or use the OnAfterLoad event of your Grid with some conditions


function store.load(sender, records, successful, operation, eOpts)
{
    if (sender.grid.needToSelectAll) {
        Ext.defer(function () {
            sender.grid.getSelectionModel().selectAll()
        }, 100);
    }
}

 

I'm trying this thing but sincerly i don't understand in what ext event i have to place the store.load function.

I'm new to JS and UNIGUI

I have tryed also to place the code UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();'); in the onafterload event of the grid but it has no effect. If i use the same code in a popup menu works fine.

thanks

Link to comment
Share on other sites

1 hour ago, Roberto Nicchi said:

I'm trying this thing but sincerly i don't understand in what ext event i have to place the store.load function.

I'm new to JS and UNIGUI

I have tryed also to place the code UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();'); in the onafterload event of the grid but it has no effect. If i use the same code in a popup menu works fine.

thanks

Hello

Please try below code

procedure TMainForm.DBGridAfterLoad(Sender: TUniCustomDBGrid);
begin
  with UniDBGrid1, JSInterface do
    JSCallDefer('getSelectionModel().selectAll', [], 100 );
end;

 

  • Like 1
Link to comment
Share on other sites

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...