Jump to content

zhyhero

uniGUI Subscriber
  • Posts

    131
  • Joined

  • Last visited

  • Days Won

    5

zhyhero last won the day on October 3 2022

zhyhero had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

zhyhero's Achievements

Active Member

Active Member (3/4)

12

Reputation

  1. Sorry for missed the point. In you testcase, #1'.iframe.contentWindow.myAlert();' => UniURLFrame1.JSName+'.iframe.contentWindow.myAlert();' UniURLFrame1.JSName => O5E or other ... O5E is on the Tree. I guess #1 just a placeholder, it will replace by some jsname on runtime. try UniURLFrame1.JSInterface.JSCode('O5E.iframe.contentWindow.myAlert();'); unisession.addjs('O5E.iframe.contentWindow.myAlert();'); And in you index.html file <script> function myAlert() { alert('peek-a-boo I see you'); console.log('out -> ',this); // this will be O5E.iframe.contentWindow }; </script> top => O5E's parent ,root of the Tree.
  2. The world is "Tree" . Run unigui app, open url in browser, and the developer-tool will tell you what is inside it. Type and run “console.log(this)” in developer-tool. (This pic shows how current session objects are organized like a tree inside the browser vm , and "this" is a "Window" type object. ) Every object may have a name ,like O6A,O10....... and MainForm. When you include an outside js file,it's content will append to the "Tree". Example ,we define a function in file "jsfunc.js", function ___js_func_1(){ alert("call js_function"); } and add "/files/jsfunc.js" to servermodule.customfiles. When uniapp initialized, the function "___js_func_1" will append to the object tree (this is "Window"). Or we put an TUniHTMLFrame on a UniForm, set HTML property with: <head> <script> function ___my_func_good(){ alert('good'); } // function append to "Window" var ___mytools={}; // object append to "Window" ___mytools.good=function (){ alert('good'); } //function append to "Window".___mytools </script> </head> <body> hello<br> <input type="button" value="click good" onclick="___my_func_good()"></input> </body> At runtime, "___my_func_good" and "___mytools" will append to the tree (this is "Window"), like pic shows. Usually,we just simple call "this.___js_func_1()", "this.___myfunc_good()" and "this.___mytools.good()". Unisession.AddJs('this.___js_func_1();'); You can add any new child object(or function) to any object on the tree, so it is important to make sure what is "this". If you dynamic create js objects or functions in runtime , you may consider how to organize them on the "Tree"
  3. Temporary : procedure TUniFrame1.UniDBGrid1AfterLoad(Sender: TUniCustomDBGrid); begin ....JSInterface.JSCall('setStyle', [JSInterface.JSObject(['top', '-2px'])], UniComboBox1.JSControl); end;
  4. Thank you. But still have problem when in a frame . source code : 20230121_UniDBGrid_Combobox_Frame.zip
  5. I add an UniCombobox to UniDBgrid's HeadTitle area, self.UniDBGrid_Sample.JSInterface.JSCall('header.insert', [1, self.UniComboBox1.JSControl]); but height of headertitle area become more bigger, so i reset the height of headertitle area to default, self.UniDBGrid_Sample.JSInterface.JSCall('header.setHeight', [HeaderHeight]); now , the position of titletext and unicombobox become strange, how to fix this? source code 20230120_UniDBGrid_Combobox.zip
  6. How about check "InTransaction" ? if FDConnection.InTransaction then begin ShowmessageN('Last Transaction is not finish'); Exit; end; FDConnection.StartTransaction; try ... FDConnection.Commit; except FDConnection.Rollback; end;
  7. What place (or unit) is your " FDConnection" created ?
  8. Synchronous and asynchronous. A lot of asynchronous with web app.
  9. I am not sure this is helpful , something (procedure or function) delayed untill OnCellClick. So i changed your source code. type TMainForm = class(TUniForm) UniDBGrid1: TUniDBGrid; UniDBNavigator1: TUniDBNavigator; DataSource1: TDataSource; procedure UniFormCreate(Sender: TObject); procedure UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer); procedure UniDBGrid1CellClick(Column: TUniDBGridColumn); private { Private declarations } DeleteJobReady: boolean; public { Public declarations } end; function MainForm: TMainForm; implementation {$R *.dfm} uses uniGUIVars, MainModule, uniGUIApplication, StrUtils; function MainForm: TMainForm; begin Result := TMainForm(UniMainModule.GetFormInstance(TMainForm)); end; procedure TMainForm.UniDBGrid1CellClick(Column: TUniDBGridColumn); begin if DeleteJobReady then begin UniMainModule.ClientDataSet1.Delete; DeleteJobReady := false; end; end; procedure TMainForm.UniDBGrid1ColumnActionClick(Column: TUniDBGridColumn; ButtonId: Integer); begin DeleteJobReady := true; end; procedure TMainForm.UniFormCreate(Sender: TObject); var I: Integer; begin DeleteJobReady := false; with UniMainModule.ClientDataSet1 do begin for I := 1 to 100 do begin Append; FieldByName('EmpNo').AsInteger := I; FieldByName('Lastname').AsString := Char(65 + Random(28)); FieldByName('Firstname').AsString := Char(65 + Random(28)); FieldByName('shift').AsBoolean := Random(2) = 1; FieldByName('BoolInt').AsInteger := Random(2); FieldByName('Boolstring').AsString := IfThen(Random(2) = 0, 'set', 'unset'); Post; end; First; end; end;
  10. 0. Loading error Theme: uni_windows11_triton Messages: GET http://localhost:8077/unipackages-7.5.1-1.70/themes/ext-theme-uni_windows11_triton/resources/fonts/OpenSans-Light.ttf net::ERR_ABORTED 404 (Not Found) GET http://localhost:8077/unipackages-7.5.1-1.70/themes/ext-theme-uni_windows11_triton/resources/fonts/OpenSans-Regular.ttf net::ERR_ABORTED 404 (Not Found) 1.CheckBox Icon lost Theme: uni_windows11, uni_windows11_triton cls-class: x-grid-checkcolumn-checked... Condition: ServerModule.IncludeFontAwesome4=false; 2.ActionColumn row Icon(Button) Lost Condition: Set Column.Title.Caption With some html tag like "<i></i>" How to fix this ?????👀 BTW, ActionColumn.Button.IconCls='fa fa-circle' Here is Demo source code Fontawesome_Test2_20221009.zip
  11. After some searching and reading in forum, I find this post. I have changed source codes according to this post. Now codes are working. It is hard to study JS(Extjs) code for me. Here is source code. 20220906_UniDBTreeGrid.zip
  12. JsViews/JsRender Two-way data link. JsView_JsonView.zip
×
×
  • Create New...