andyhill Posted October 12, 2017 Share Posted October 12, 2017 I want to be able to add to the uniDbGrid Tray (for lack of a word) extra objects (in particular SpeedButtons) - please show me how - thanks. Mock up attached. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 12, 2017 Share Posted October 12, 2017 Hi, For a start you can do this: function pagingBar.boxready(sender, width, height, eOpts) { this.add({ text: "Test", handler: function() { alert("test") } }); } Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 12, 2017 Author Share Posted October 12, 2017 OK, which JS section do I add it ? Also, will I be able to add buttons ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 12, 2017 Share Posted October 12, 2017 Also, will I be able to add buttons ? This is the button. OK, which JS section do I add it ? UniDBGrid1 -> ClientEvents -> ExtEvents -> Ext.toolbar.Paging [pagingBar] -> function pagingBar.boxready Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 12, 2017 Author Share Posted October 12, 2017 Please show me Delphi code as all attempts with ExtEvents fail (there is no toolbar) ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 13, 2017 Share Posted October 13, 2017 Please show me Delphi code as all attempts with ExtEvents fail (there is no toolbar) ? Quote Link to comment Share on other sites More sharing options...
mhmda Posted October 13, 2017 Share Posted October 13, 2017 Hi Project from here: http://3msoft.net/mhmd/dbgridtray.rar We will turn paging tool bar from: To this: What we did: We hide the First page, Last page, Refresh buttons We add a label to show how many selected rows we add two buttons aligned to the right We will use two images and we will put them inside a folder 'images': when we want to hide buttons we will need there index... 1 Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 13, 2017 Author Share Posted October 13, 2017 Thank You Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 13, 2017 Author Share Posted October 13, 2017 Taking this a step forward:- How can I use Icons from an UniImageList instead of a file ? How would I use a UniDatePicker instead of a button ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 17, 2017 Author Share Posted October 17, 2017 With my uniDBGrid I want to add two uniDatePickers (not time) to the paging bar next to the Refresh button and capture the date change so I can fetch new data - please advise. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 Hi, With my uniDBGrid I want to add two uniDatePickers (not time) to the paging bar next to the Refresh button and capture the date change so I can fetch new data - please advise. Can you try this approach ?!: function pagingBar.boxready(sender, width, height, eOpts) { this.add([ '-', { xtype: "datefield", fieldLabel: 'Start Date', labelWidth: "60px", format: 'm/d/Y', width: 200, listeners: { change: function(el, v) { alert(v) } } }, '-', { xtype: "datefield", fieldLabel: 'End Date', labelWidth: "60px", format: 'm/d/Y', width: 200, listeners: { change: function(el, v) { alert(v) } } } ]); } Best regards, Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 Thank You . Moving forward:- 1) I need to seed them with today's date 2) I want to fire a delphi procedure when the date is changed (not counting seeding) 3) When midnight is crossed I would need to re-seed them with the new date Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 1) I need to seed them with today's date { xtype: "datefield", fieldLabel: 'Start Date', labelWidth: "60px", format: 'm/d/Y', value: new Date(), // <---------- width: 200, listeners: { change: function(el, v) { alert(v) } } } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 2) I want to fire a delphi procedure when the date is changed (not counting seeding) Well, try this: 1. { xtype: "datefield", fieldLabel: 'Start Date', labelWidth: "60px", format: 'm/d/Y', value: new Date(), width: 200, listeners: { change: function(el, v) { ajaxRequest(sender, "_dateChange", ["dtIndx=0", "val=" + Ext.Date.format(v, "d/m/Y")]) // <------ } } } 2. procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var newDate : TDate; Fmt: TFormatSettings; begin if EventName = '_dateChange' then begin Fmt.ShortDateFormat:='dd/mm/yyyy'; Fmt.DateSeparator :='/'; newDate := StrToDate(Params.Values['val'], Fmt); //ShowMessage(DateToStr(newDate)); end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 3) When midnight is crossed I would need to re-seed them with the new date ? Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 Perfect - Thank You Farshad, I appreciate your help. 3) I intend to have a session (dashboard) last indefinitely so when the clock ticks past midnight I will need to re-seed the date pickers -or- restart the app automatically ? Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 Could you show me how to achieve 3) above - thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 Hi, Could you show me how to achieve 3) above - thanks If I understand you correctly, first of all you must determine this time most likely in the UniTimer I guess, and after setting the date, to disable the timer and re-enable after a certain time... How can you do this? Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 OK, that is strait forward, use timer event to test current date. Now when date needs to be changed, how in code at runtime would I change the DatePickers as they are not delphi objects ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 For example: 1. uses ... DateUtils 2. UniTimer: Interval = 60000 OnTimer -> procedure TMainForm.UniTimer1Timer(Sender: TObject); begin if CompareTime(Time, EncodeTime(0,0,0,0)) >= 1 then begin UniTimer1.Interval := ? // or other logic UniSession.AddJS('Ext.getCmp("startDateID").setValue(new Date());'); end ... ... end; 3. { xtype: "datefield", fieldLabel: 'Start Date', labelWidth: "60px", format: 'm/d/Y', value: new Date(), id: "startDateID", //<-------------- width: 200, listeners: { change: function(el, v) { ajaxRequest(sender, "_dateChange", ["dtIndx=0", "val=" + Ext.Date.format(v, "d/m/Y")]) } } } Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 Thank you Farsad, if we every meet up I owe you a beer. Quote Link to comment Share on other sites More sharing options...
onur Posted October 5, 2018 Share Posted October 5, 2018 On 10/12/2017 at 10:59 PM, Sherzod said: Hi, For a start you can do this: function pagingBar.boxready(sender, width, height, eOpts) { this.add({ text: "Test", handler: function() { alert("test") } }); } On 10/18/2017 at 11:26 PM, andyhill said: Thank you Farsad, if we every meet up I owe you a beer. 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.