Luciano França Posted December 30, 2022 Share Posted December 30, 2022 This example how could I do ? I tried this but it doesn't work With UniDBTreeGrid1.ClientEvents.ExtEvents do begin Clear; Add('function store.load(sender, records, successful, operation, eOpts)'); Add('{ var me=sender; me.remoteSort=false; '); Add(' me.sort({property:0, direction:"ASC"}); }'); End; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 30, 2022 Share Posted December 30, 2022 Hello, Can you please specify first, which edition and build of UniGUI are you using? Quote Link to comment Share on other sites More sharing options...
Luciano França Posted December 30, 2022 Author Share Posted December 30, 2022 (edited) 2 hours ago, Sherzod said: Hello, Can you please specify first, which edition and build of UniGUI are you using? I'm testing the latest trial version Edited December 30, 2022 by luapfr Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 1, 2023 Share Posted January 1, 2023 On 12/31/2022 at 2:29 AM, luapfr said: I'm testing the latest trial version Recently started evaluating uniGUI again!? Quote Link to comment Share on other sites More sharing options...
Luciano França Posted January 1, 2023 Author Share Posted January 1, 2023 Yes I have an old account now I have just joined the unigui team with the purchase of a Unigui Professional license. I'm sorry but I use Google translator let's go to the question how could I do it by pascal code ? With UniDBTreeGrid1.ClientEvents.ExtEvents do begin Clear; Add('function store.load(sender, records, successful, operation, eOpts)'); Add('{ var me=sender; me.remoteSort=false; '); Add(' me.sort({property:0, direction:"ASC"}); }'); End; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 2, 2023 Share Posted January 2, 2023 19 hours ago, luapfr said: now I have just joined the unigui team with the purchase of a Unigui Professional license. Hello, thank you. 19 hours ago, luapfr said: let's go to the question how could I do it by pascal code ? With UniDBTreeGrid1.ClientEvents.ExtEvents do begin Clear; Add('function store.load(sender, records, successful, operation, eOpts)'); Add('{ var me=sender; me.remoteSort=false; '); Add(' me.sort({property:0, direction:"ASC"}); }'); End; What exactly do you want to achieve? Quote Link to comment Share on other sites More sharing options...
Luciano França Posted January 2, 2023 Author Share Posted January 2, 2023 I want to put a JS code by pascal but I can't. this my attempt fails the only way I can put a JS code is in Designer mode Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 2, 2023 Share Posted January 2, 2023 45 minutes ago, luapfr said: the only way I can put a JS code is in Designer mode Use it in the form's OnCreate event. Quote Link to comment Share on other sites More sharing options...
Luciano França Posted January 2, 2023 Author Share Posted January 2, 2023 32 minutes ago, Sherzod said: Use it in the form's OnCreate event. I just tried and the page just keeps loading... something is wrong please see my code procedure TMainForm.UniFormCreate(Sender: TObject); begin With UniDBTreeGrid1.ClientEvents.ExtEvents do begin Clear; Add('function store.load(sender, records, successful, operation, eOpts)'); Add('{ var me=sender; me.remoteSort=false; '); Add(' me.sort({property:0, direction:"ASC"}); }'); End; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 2, 2023 Share Posted January 2, 2023 UniDBGrid1.ClientEvents.ExtEvents.Values['store.load'] := 'function store.load(sender, records, successful, operation, eOpts){var me=sender; me.remoteSort=false; me.sort({property:0, direction:"ASC"});}'; 1 Quote Link to comment Share on other sites More sharing options...
Luciano França Posted January 2, 2023 Author Share Posted January 2, 2023 8 hours ago, Sherzod said: UniDBGrid1.ClientEvents.ExtEvents.Values['store.load'] := 'function store.load(sender, records, successful, operation, eOpts){var me=sender; me.remoteSort=false; me.sort({property:0, direction:"ASC"});}'; How could I do if the component is created in RunTime See this code below does not work procedure TMainForm.UniBitBtn1Click(Sender: TObject); Var UniDBTreeList: TUniDBTreeGrid; begin UniDBTreeList := TUniDBTreeGrid.Create(Self); UniDBTreeList.DataSource := DataSource2; UniDBTreeList.ClientEvents.ExtEvents.Values['store.load'] := 'function store.load(sender, records, successful, operation, eOpts){var me=sender; me.remoteSort=false; me.sort({property:0, direction:"ASC"});}'; With UniDBTreeList do Begin Parent := Self; Left := 27; Top := 48; Width := 250; Height := 250; Hint := ''; Font.Color := clBlack; Font.Height := -15; Font.Name := 'Arial'; ParentFont := False; LoadMask.Message := 'Loading data...'; UseArrows := True; IdParentField := 'PARENTID'; IdField := 'ID'; with Columns.Add as TUniBaseDBGridColumn do Begin FieldName := 'MENU_ITEM'; Title.Caption := 'Menu'; Title.Font.Charset := ANSI_CHARSET; Title.Font.Height := -15; Title.Font.Name := 'Arial'; Width := 421; Font.Charset := ANSI_CHARSET; Font.Color := clBlack; Font.Height := -15; Font.Name := 'Arial'; ReadOnly := True; end; end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2023 Share Posted January 3, 2023 Hello, Can you make a simple testcase to check, and attach here? Quote Link to comment Share on other sites More sharing options...
Luciano França Posted January 3, 2023 Author Share Posted January 3, 2023 Attached example using a TClientDataSet UniGui ExtEvents.7z Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2023 Share Posted January 3, 2023 18 minutes ago, luapfr said: UniGui ExtEvents.7z 32.89 kB · 0 downloads Thanks. We will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2023 Share Posted January 3, 2023 55 minutes ago, luapfr said: UniGui ExtEvents.7z 32.89 kB · 0 downloads Try this approach for now: //UniDBTreeList.ClientEvents.ExtEvents.Values['store.load'] := // 'function store.load(sender, records, successful, operation, eOpts){var me=sender; me.remoteSort=false; me.sort({property:0, direction:"ASC"});}'; UniDBTreeList.JSInterface.JSAddElListener('load', 'store', UniDBTreeList.JSInterface.JSFunction('', 'var me=this; me.remoteSort=false; me.sort({property:0, direction:"ASC"});')); Quote Link to comment Share on other sites More sharing options...
Luciano França Posted January 3, 2023 Author Share Posted January 3, 2023 46 minutes ago, Sherzod said: Try this approach for now: //UniDBTreeList.ClientEvents.ExtEvents.Values['store.load'] := // 'function store.load(sender, records, successful, operation, eOpts){var me=sender; me.remoteSort=false; me.sort({property:0, direction:"ASC"});}'; UniDBTreeList.JSInterface.JSAddElListener('load', 'store', UniDBTreeList.JSInterface.JSFunction('', 'var me=this; me.remoteSort=false; me.sort({property:0, direction:"ASC"});')); It works Much obliged. 1 Quote Link to comment Share on other sites More sharing options...
artem_niko Posted March 20, 2023 Share Posted March 20, 2023 On 1/2/2023 at 10:12 PM, Sherzod said: UniDBGrid1.ClientEvents.ExtEvents.Values['store.load'] := 'function store.load(sender, records, successful, operation, eOpts){var me=sender; me.remoteSort=false; me.sort({property:0, direction:"ASC"});}'; Hello! Is this code is correct for UniForm (create dynamically)?: procedure TUniFrame1.DynamForm; var f: TUniForm; begin f:=TUniForm.Create(UniApplication); f.ClientEvents.ExtEvents.Values['window.show']:= 'function window.show(sender, eOpts) {' + 'var el = sender.getE1(); ' + 'el.setOpacity(0); ' + 'el.fadeIn({duration: 1000});}'; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 20, 2023 Share Posted March 20, 2023 Hello, 1 hour ago, artem_niko said: f.ClientEvents.ExtEvents.Values['window.show']:= Yes. But it's wrong here: 1 hour ago, artem_niko said: getE1 getEl Quote Link to comment Share on other sites More sharing options...
artem_niko Posted March 20, 2023 Share Posted March 20, 2023 4 minutes ago, Sherzod said: But it's wrong here Why? What right? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 20, 2023 Share Posted March 20, 2023 10 hours ago, artem_niko said: What right? 10 hours ago, Sherzod said: getEl 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.