bolossis Posted December 17, 2017 Share Posted December 17, 2017 Hi, is it possible to have an UniStringGrid cell editor? I try the hidden panel but this works only for UniDBGrid. I have some Boolean values on a Stringgrid and want to have a checkbox inside the cells. Any solution? I check out the demos but found only solution for DBGrid. Quote Link to comment Share on other sites More sharing options...
bolossis Posted December 21, 2017 Author Share Posted December 21, 2017 I would like some help here :P Thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 21, 2017 Share Posted December 21, 2017 Hi, We will try... Best regards, Quote Link to comment Share on other sites More sharing options...
bolossis Posted December 21, 2017 Author Share Posted December 21, 2017 +1 Thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 22, 2017 Share Posted December 22, 2017 Hi, Do you use FixedCols ? Quote Link to comment Share on other sites More sharing options...
bolossis Posted December 22, 2017 Author Share Posted December 22, 2017 Yes one fixed Col and one Fixed Row. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 22, 2017 Share Posted December 22, 2017 Ok, I'm trying Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 22, 2017 Share Posted December 22, 2017 Yes one fixed Col and one Fixed Row. If possible, can you make a testcase ?! I'll work on your test case Quote Link to comment Share on other sites More sharing options...
bolossis Posted December 22, 2017 Author Share Posted December 22, 2017 Hi Delphi Develeoper, you dont need a test case here, its just a stringgrid with example 20 columns and 10 rows, one Fixed Cold and one Fixed Row and in the rest of the cells they should be a check box or a combobox where user can select false or true. 0 = False 1 = True Except of using zero and one, i would insert a check box or combobox (items=True,False) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 22, 2017 Share Posted December 22, 2017 Ok, thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 23, 2017 Share Posted December 23, 2017 Hi, Can you try to use this approach for now ?! For example: 1. UniStringGrid1 -> ClientEvents -> UniEvents -> function beforeInit: function beforeInit(sender, config) { var me=sender; me._check=function(v, r, c){ ajaxRequest(me, '_check', ['value='+v, 'rowIndex='+r, 'columnIndex='+(c+me.fxCols)]); } } 2. UniStringGrid1 -> ClientEvents -> ExtEvents -> function reconfigure: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { for (i = sender.fxCols; i < columns.length; i++) { columns[i].rdonly=true; columns[i].align = 'center'; columns[i].renderer = function(value, a) { return "<input type='checkbox'" + ((value == '1') ? "checked='checked'" : "") + " onclick='"+sender.nm+"._check(+this.checked, "+a.rowIndex+", "+a.columnIndex+")'>"; }; } } 3. UniStringGrid1 -> OnAjaxEvent: procedure TMainForm.UniStringGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName='_check' then (Sender as TUniStringGrid).Cells[StrToInt(Params.Values['columnIndex']), StrToInt(Params.Values['rowIndex'])] := Params.Values['value'] end; Result: Best regards, 1 Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted December 23, 2017 Share Posted December 23, 2017 +1 Bravo DD I was looking for something like this. 1 Quote Link to comment Share on other sites More sharing options...
bolossis Posted December 23, 2017 Author Share Posted December 23, 2017 You are great. Thank you very much. Exactly the sollution i needed +1 +1 +1 1 Quote Link to comment Share on other sites More sharing options...
isam Posted January 2, 2018 Share Posted January 2, 2018 Hello, is it possible to have an UniStringGrid with combobox in cell? Please i need help Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 2, 2018 Share Posted January 2, 2018 Hi, Hello, is it possible to have an UniStringGrid with combobox in cell? Please i need help Which edition and build are you using ?! Best regards, Quote Link to comment Share on other sites More sharing options...
isam Posted January 2, 2018 Share Posted January 2, 2018 i use v1.0.0.1397 thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 2, 2018 Share Posted January 2, 2018 Trial ? Quote Link to comment Share on other sites More sharing options...
isam Posted January 3, 2018 Share Posted January 3, 2018 Trial ? Yes Trial edition ... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 Hi, First of all, please use the latest version and build Quote Link to comment Share on other sites More sharing options...
bolossis Posted January 3, 2018 Author Share Posted January 3, 2018 Hi, i try to add and remove the events on runtime, is it possible? If yes what do i wrong? it dows not work procedure TRatesManagerForm.UniRadioButton9Click(Sender: TObject); begin MyGrid.ClientEvents.ExtEvents.Clear; MyGrid.ClientEvents.UniEvents.Clear; RestGrid.ClientEvents.ExtEvents.Values['beforeInit'] := 'function (sender, config) ' + '{ ' + ' var me=sender; ' + ' me._check=function(v, r, c){ ' + ' ajaxRequest(me, ''_check'', [''value=''+v, ''rowIndex=''+r, ''columnIndex=''+(c+me.fxCols)]); ' + ' } ' + '} '; MyGrid.ClientEvents.UniEvents.Values['reconfigure'] := 'function (sender, store, columns, oldStore, oldColumns, eOpts) ' + '{ ' + ' for (i = sender.fxCols; i < columns.length; i++) { ' + ' columns[i].rdonly=true; ' + ' columns[i].align = ''center''; ' + ' columns[i].renderer = function(value, a) { ' + ' return "<input type=''checkbox''" + ((value == ''1'') ? "checked=''checked''" : "") + " onclick=''"+sender.nm+"._check(+this.checked, "+a.rowIndex+", "+a.columnIndex+")''>"; ' + ' }; ' + ' } ' + '} '; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 Hi, Sorry, which events, function do you want to change? Quote Link to comment Share on other sites More sharing options...
bolossis Posted January 3, 2018 Author Share Posted January 3, 2018 Both for this topic. Before init and reconfigure Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 Only before initialization Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 But, you can change _check function dynamically Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 Please explain a bit more, what you wanted, we will see 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.