bolossis Posted January 3, 2018 Author Share Posted January 3, 2018 Part one was the checkbox filed inside UniStringgrid. Now if you see in the image bellow i would like to activate - shows the checkbox fields only if radiobutton 3 or 4 are checked ( there are 4 chechboxes above the grid on the image, Min Stay, Max Stay, CTA, CTD) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 Otherwise, only the value? Quote Link to comment Share on other sites More sharing options...
bolossis Posted January 3, 2018 Author Share Posted January 3, 2018 exactly Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 Ok, I will try and let you know Quote Link to comment Share on other sites More sharing options...
bolossis Posted January 3, 2018 Author Share Posted January 3, 2018 Thank you Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 Can you try to use this approach for now ?!: 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)]); }; me.isCheckbox=false; //<---------- } 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=me.isCheckbox; //<---------- columns[i].align = 'center'; columns[i].renderer = function(value, a) { return ((me.isCheckbox) ? "<input type='checkbox'" + ((value == '1') ? "checked='checked'" : "") + " onclick='"+sender.nm+"._check(+this.checked, "+a.rowIndex+", "+a.columnIndex+")'>" : value); //<---------- }; } } 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; 4. How to use, for example: procedure TMainForm.UniCheckBox1Click(Sender: TObject); begin with UniStringGrid1.JSInterface do begin JSAssign('isCheckbox', [UniCheckBox1.Checked]); JSCall('view.refresh', []); end; end; Best regards, Quote Link to comment Share on other sites More sharing options...
bolossis Posted January 3, 2018 Author Share Posted January 3, 2018 Unfortunately i receive me is not defined Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2018 Share Posted January 3, 2018 Unfortunately i receive me is not defined Oh, sorry: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var me = sender; //<---------- for (i = sender.fxCols; i < columns.length; i++) { columns[i].rdonly=me.isCheckbox; //<---------- columns[i].align = 'center'; columns[i].renderer = function(value, a) { return ((me.isCheckbox) ? "<input type='checkbox'" + ((value == '1') ? "checked='checked'" : "") + " onclick='"+sender.nm+"._check(+this.checked, "+a.rowIndex+", "+a.columnIndex+")'>" : value); //<---------- }; } } Quote Link to comment Share on other sites More sharing options...
bolossis Posted January 3, 2018 Author Share Posted January 3, 2018 Awesome. Thank you really very much!!!! +1 Quote Link to comment Share on other sites More sharing options...
bolossis Posted February 20, 2018 Author Share Posted February 20, 2018 An important question. Can i do show checkboxes like in the example here only for specific rows? Like show checkbox only for line(row) 1 or 2 etc? This example here is great but when fixed Rows exists then it replace the fixed-rows value with a checkbox function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var me = sender; //<---------- for (i = sender.fxCols; i < columns.length; i++) { columns[i].rdonly=me.isCheckbox; //<---------- columns[i].align = 'center'; columns[i].renderer = function(value, a) { return ((me.isCheckbox) ? "<input type='checkbox'" + ((value == '1') ? "checked='checked'" : "") + " onclick='"+sender.nm+"._check(+this.checked, "+a.rowIndex+", "+a.columnIndex+")'>" : value); //<---------- }; } } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 22, 2018 Share Posted February 22, 2018 Hi, You can try this: me.isCheckbox && (a.rowIndex < 2) //<---------- function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var me = sender; //<---------- for (i = sender.fxCols; i < columns.length; i++) { columns[i].rdonly = me.isCheckbox; //<---------- columns[i].align = 'center'; columns[i].renderer = function(value, a) { return ((me.isCheckbox && (a.rowIndex < 2)) ? "<input type='checkbox'" + ((value == '1') ? "checked='checked'" : "") + " onclick='" + sender.nm + "._check(+this.checked, " + a.rowIndex + ", " + a.columnIndex + ")'>" : value); //<---------- }; } } Best regards, Quote Link to comment Share on other sites More sharing options...
mos Posted August 7, 2018 Share Posted August 7, 2018 Hi Delphi Developer, I am trying to use the code on the first page to display a checkbox in a stringgrid but it doesn't seem to work. Is there some changes that need to be made to the original code so it works under Ext JS 6.5? I am using Complete Professional 1466. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 7, 2018 Share Posted August 7, 2018 Hi, Need to analyze it Quote Link to comment Share on other sites More sharing options...
mos Posted August 10, 2018 Share Posted August 10, 2018 Hi Delphi Developer, Any update on this? Quote Link to comment Share on other sites More sharing options...
mos Posted August 29, 2018 Share Posted August 29, 2018 Hi Delphi Developer, Bumping this. Still waiting for a fix. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 29, 2018 Share Posted August 29, 2018 Hi, I am trying to use the code on the first page to display a checkbox in a stringgrid but it doesn't seem to work. Sorry for clarification, what do you mean by saying "first page" ?! Quote Link to comment Share on other sites More sharing options...
mos Posted August 29, 2018 Share Posted August 29, 2018 Hi Delphi Developer, The code you posted on the first page of this thread on the 23rd Dec 2017. function beforeInit(sender, config) { var me=sender; me._check=function(v, r, c){ ajaxRequest(me, '_check', ['value='+v, 'rowIndex='+r, 'columnIndex='+(c+me.fxCols)]); } } etc... Quote Link to comment Share on other sites More sharing options...
mos Posted September 11, 2018 Share Posted September 11, 2018 Hi Delphi Developer, Still waiting for an update. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted September 18, 2019 Share Posted September 18, 2019 Does anyone have this example working? I can't play this code Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 18, 2019 Share Posted September 18, 2019 16 minutes ago, eduardosuruagy said: Does anyone have this example working? I can't play this code Can you please explain in more detail, what you wanted and what problem do you have? Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted September 18, 2019 Share Posted September 18, 2019 10 minutes ago, Sherzod said: Você pode explicar com mais detalhes o que você queria e qual o seu problema? I wanted to put the checkbox in the stringgrid cell, and the codes that are here I couldn't make it work. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 18, 2019 Share Posted September 18, 2019 3 minutes ago, eduardosuruagy said: I wanted to put the checkbox in the stringgrid cell, and the codes that are here I couldn't make it work. Ok, I will check. Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted January 2, 2020 Share Posted January 2, 2020 Why this have to be so difficult ? Why not simply put a property on the stringgrid itself (isCheckColumn) just like the uniDBgrid have ? Or even better, let us choose what control to put on the column ? Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted January 2, 2020 Share Posted January 2, 2020 So many new features.. Why so many Basic features missing ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 3, 2020 Share Posted January 3, 2020 12 hours ago, RobertoLopes said: So many new features.. Why so many Basic features missing ? But as you know, as the name implies, the cells of the UniStringGrid component may contain data of type String in the first place. 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.