Commit 0f0245b5 by Cam Hayes

fixed issue with add customers and add item only showing 100 entries, and added…

fixed issue with add customers and add item only showing 100 entries, and added a label displaying the number of entries in the grid
parent f25d59b2
......@@ -30,6 +30,15 @@ object FSelectCustomer: TFSelectCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblEntries: TWebLabel
Left = 4
Top = 78
Width = 93
Height = 15
Caption = 'Showing Entries...'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 4
Top = 48
......@@ -208,7 +217,7 @@ object FSelectCustomer: TFSelectCustomer
OnCellClick = TMSFNCGrid1CellClick
end
object btnCancel: TWebButton
Left = 556
Left = 542
Top = 47
Width = 96
Height = 25
......@@ -241,8 +250,8 @@ object FSelectCustomer: TFSelectCustomer
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 630
Top = 47
Left = 534
Top = 269
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
......
......@@ -30,6 +30,7 @@ type
WebLabel3: TWebLabel;
edtID: TWebEdit;
xdwdsCustomersInKGOrders: TBooleanField;
lblEntries: TWebLabel;
procedure WebFormCreate(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
......@@ -167,6 +168,7 @@ begin
finally
TMSFNCGrid1.EndUpdate;
end;
lblEntries.Caption := 'Showing ' + IntToStr(TMSFNCGrid1.RowCount - 1) + ' entries...';
Utils.HideSpinner('spinner');
end;
......@@ -207,6 +209,7 @@ begin
// Apply the filters to the grid
TMSFNCGrid1.ApplyFilter;
lblEntries.Caption := 'Showing ' + IntToStr(TMSFNCGrid1.RowCount - 1) + ' entries...';
end;
end.
\ No newline at end of file
......@@ -21,6 +21,15 @@ object fViewAddItem: TfViewAddItem
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblEntries: TWebLabel
Left = 4
Top = 130
Width = 93
Height = 15
Caption = 'Showing Entries...'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 4
Top = 102
......@@ -29,6 +38,7 @@ object fViewAddItem: TfViewAddItem
ChildOrder = 2
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
......@@ -247,8 +257,8 @@ object fViewAddItem: TfViewAddItem
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 166
Top = 129
Left = 546
Top = 19
object xdwdsCustomersqb_items_id: TStringField
FieldName = 'qb_items_id'
end
......@@ -267,7 +277,7 @@ object fViewAddItem: TfViewAddItem
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 104
Top = 135
Left = 572
Top = 7
end
end
......@@ -30,15 +30,18 @@ type
xdwdsCustomersitem_desc: TStringField;
xdwdsCustomersstatus: TStringField;
xdwdsCustomersqb_items_qb_id: TStringField;
lblEntries: TWebLabel;
procedure WebFormCreate(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure edtSearchChange(Sender: TObject);
private
{ Private declarations }
[async] procedure getItems();
procedure PopulateGridManually();
procedure ApplyFilter();
[async] procedure SendItemToServer();
var
mode: string;
......@@ -98,6 +101,11 @@ begin
end;
end;
procedure TfViewAddItem.edtSearchChange(Sender: TObject);
begin
ApplyFilter();
end;
procedure TfViewAddItem.getItems;
var
xdcResponse: TXDataClientResponse;
......@@ -164,6 +172,7 @@ begin
finally
TMSFNCGrid1.EndUpdate;
end;
lblEntries.Caption := 'Showing ' + IntToStr(TMSFNCGrid1.RowCount - 1) + ' entries...';
Utils.HideSpinner('spinner');
end;
......@@ -173,6 +182,38 @@ begin
edtName.Text := TMSFNCGrid1.Cells[1, ARow];
end;
procedure TFViewAddItem.ApplyFilter;
// filters the grid based on search textbox contents.
var
fd: TTMSFNCGridFilterData;
i: Integer;
SearchText: string;
begin
SearchText := Trim(edtSearch.Text);
TMSFNCGrid1.RemoveFilter;
TMSFNCGrid1.Filter.Clear;
// match on first 3 columns
for i := 0 to 2 do
begin
fd := TMSFNCGrid1.Filter.Add;
fd.Column := i;
fd.Condition := '*' + SearchText + '*'; // Match text anywhere in the cell
fd.CaseSensitive := False; // Make the filter case-insensitive
// Use foOR for "match any column" logic
if i > 0 then
fd.Operation := foOR
else
fd.Operation := foNONE; // First filter has no logical operation
end;
// Apply the filters to the grid
TMSFNCGrid1.ApplyFilter;
lblEntries.Caption := 'Showing ' + IntToStr(TMSFNCGrid1.RowCount - 1) + ' entries...';
end;
procedure TFViewAddItem.SendItemToServer;
var
ItemJSON: TJSONObject;
......@@ -199,7 +240,6 @@ begin
// Utils.HideSpinner('spinner');
Close();
end;
end.
\ No newline at end of file
{
"AuthUrl" : "https://webapps.em-sys.net/kgOrders/auth/",
"ApiUrl" : "https://webapps.em-sys.net/kgOrders/api/"
"AuthUrl" : "http://localhost:2001/emsys/kgOrders/auth/",
"ApiUrl" : "http://localhost:2001/emsys/kgOrders//api/"
}
......@@ -2935,7 +2935,7 @@ begin
restClient.BaseURL := BaseUrl;
restRequest.Method := rmGET;
res := '/v3/company/' + CompanyID + '/query?query=select * from Customer&minorversion=75';
res := '/v3/company/' + CompanyID + '/query?query=select * from Customer maxresults 1000&minorversion=75';
restRequest.Resource := res;
param := restRequest.Params.AddItem;
......@@ -2970,6 +2970,7 @@ begin
Result.data := TList<TQBCustomerItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result.data);
Result.count := CustomerList.Count;
for I := 0 to CustomerList.Count - 1 do
begin
Customer := CustomerList.Items[I] as TJSONObject;
......@@ -3414,7 +3415,7 @@ begin
restClient.BaseURL := BaseUrl;
restRequest.Method := rmGET;
res := '/v3/company/' + companyID + '/query?query=select * from Item&minorversion=75';
res := '/v3/company/' + companyID + '/query?query=select * from Item maxresults 1000&minorversion=75';
restRequest.Resource := res;
param := restRequest.Params.AddItem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment