Sherzod Posted October 30, 2020 Share Posted October 30, 2020 2 minutes ago, eduardosuruagy said: if User.Exclude = False then False else true; OnFormCreate ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2020 Share Posted October 30, 2020 33 minutes ago, Sherzod said: OnFormCreate ? 1. procedure TMainForm.UniFormCreate(Sender: TObject); begin //conditions... True or False UniDBGrid1.JSInterface.JSAssign('isExcluded', [True]); end; 2. function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns[6].items[0].getClass = function (v, metadata, record) { if (sender.isExcluded) { return 'x-hidden' } else { return 'x-uni-action-cls'; } }; } Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted October 30, 2020 Share Posted October 30, 2020 1 hour ago, Sherzod said: 1. procedure TMainForm.UniFormCreate(Sender: TObject); begin //conditions... True or False UniDBGrid1.JSInterface.JSAssign('isExcluded', [True]); end; 2. function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { columns[6].items[0].getClass = function (v, metadata, record) { if (sender.isExcluded) { return 'x-hidden' } else { return 'x-uni-action-cls'; } }; } In this command can I pass which icon do I want to disable? UniDBGrid1.JSInterface.JSAssign ('isExcluded', [True]); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2020 Share Posted October 30, 2020 1 hour ago, eduardosuruagy said: In this command can I pass which icon do I want to disable? Approximate solution... procedure TMainForm.UniFormReady(Sender: TObject); begin with UniDBGrid1 do begin //first btn JSInterface.JSCode(#1'.columnManager.columns[6].items[0].getClass = function(v, metadata, record) {'+ ' return "x-hidden"'+ '};'); //second btn JSInterface.JSCode(#1'.columnManager.columns[6].items[1].getClass = function(v, metadata, record) {'+ ' return "x-hidden"'+ '};'); end; end; Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted November 1, 2020 Share Posted November 1, 2020 On 10/30/2020 at 5:35 PM, Sherzod said: Approximate solution... procedure TMainForm.UniFormReady(Sender: TObject); begin with UniDBGrid1 do begin //first btn JSInterface.JSCode(#1'.columnManager.columns[6].items[0].getClass = function(v, metadata, record) {'+ ' return "x-hidden"'+ '};'); //second btn JSInterface.JSCode(#1'.columnManager.columns[6].items[1].getClass = function(v, metadata, record) {'+ ' return "x-hidden"'+ '};'); end; end; Sorry for my insistence, but I couldn't get it to work, here is an example I did. DbGrid.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 1, 2020 Share Posted November 1, 2020 I will check your testcase. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 1, 2020 Share Posted November 1, 2020 1 hour ago, eduardosuruagy said: Sorry for my insistence, but I couldn't get it to work, here is an example I did. Yes sorry, you are using the dgCheckSelect option, so the columns are renumbered +1 Use columnManager.columns[3] instead of columnManager.columns[2] Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted November 1, 2020 Share Posted November 1, 2020 2 hours ago, Sherzod said: Sim, desculpe, você está usando a opção dgCheckSelect, então as colunas são renumeradas para +1 Usar columnManager.columns [ 3 ] ao invés de columnManager.columns [ 2 ] It worked perfect, thank you very much !! 1 Quote Link to comment Share on other sites More sharing options...
krammers Posted March 15, 2022 Share Posted March 15, 2022 On 2/13/2019 at 5:45 AM, Sherzod said: OK, You can try to use getClass config 1. In DesignTime: YourActionColumnButton -> ImageIndex = -1 2. UniDBGrid -> ClientEvents -> ExtEvents -> function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts): function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { dataColIndx = 0; actionColIndx = 6; actionItemsIndx = 0; columns[actionColIndx].items[actionItemsIndx].isActionDisabled = function (grid, rowIndex, colIndex, items, record) { return (record.data[dataColIndx] > 1500); }; columns[actionColIndx].items[actionItemsIndx].getClass = function(value, metadata, record) { if (record.data[dataColIndx] > 1500) { return "x-fa fa-home" } else { return "x-fa fa-user" } }; } Hi Sherzod!!! How do I put colors in -> return "x-fa fa-home" Quote Link to comment Share on other sites More sharing options...
artem_niko Posted May 11, 2022 Share Posted May 11, 2022 Hello! Some question. In my UniDBGrid exist fields with values 0,1 or 2. Also, in UniDBGrid exist column with ActionColumn[6] with one button. What I want? I want that if in value at my field = 1 then Button in ActionColumn[6] will be Disabled or Hide for row. I add code: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { if (columns[0].xtype && columns[0].xtype == 'rownumberer') { columns[0].width = 55; } dataColIndx = 0; actionColIndx = 6; actionItemsIndx = 1; columns[actionColIndx].items[actionItemsIndx].isActionDisabled = function (grid, rowIndex, colIndex, items, record) { return (record.data[dataColIndx] = 1); } } But I get error: I think, I'm wrong in count of column... Just hide Button in ActionColumn[6], if value = 1 in my field... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 11, 2022 Share Posted May 11, 2022 Hello, The column index is zero based... Quote Link to comment Share on other sites More sharing options...
MSMK Posted November 17, 2023 Share Posted November 17, 2023 On 2/13/2019 at 10:07 AM, Sherzod said: Hi, Can you try to use this approach for now? UniDBGrid -> ClientEvents -> ExtEvents -> function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts): function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { dataColIndx = 0; actionColIndx = 6; actionItemsIndx = 0; columns[actionColIndx].items[actionItemsIndx].isActionDisabled = function (grid, rowIndex, colIndex, items, record) { return (record.data[dataColIndx] > 1500); } } function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { dataColIndx = sender.headerCt.findColumnIndex('CustNo'); actionColIndx = 6; actionItemsIndx = 0; columns[actionColIndx].items[actionItemsIndx].isActionDisabled = function (grid, rowIndex, colIndex, items, record) { return (record.data[dataColIndx] > 1500); } } Приветствую! Как получить индекс по имени FieldName??? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 17, 2023 Share Posted November 17, 2023 27 minutes ago, =GGG= said: Приветствую! Как получить индекс по имени FieldName??? Hello, This post may help you (этот пост может Вам помочь): Quote Link to comment Share on other sites More sharing options...
picyka Posted November 22, 2023 Share Posted November 22, 2023 Would it be possible to create a rule to change the color of the icon? The rule must be based on a field in the dataset Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 24, 2023 Share Posted November 24, 2023 On 11/23/2023 at 1:56 AM, picyka said: Would it be possible to create a rule to change the color of the icon? The rule must be based on a field in the dataset Hello, Predefined colors? Quote Link to comment Share on other sites More sharing options...
picyka Posted November 24, 2023 Share Posted November 24, 2023 4 minutes ago, Sherzod said: Olá; Cores predefinidas? Green, Blue, Orange Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 24, 2023 Share Posted November 24, 2023 Are you using FontAwesome icons? Quote Link to comment Share on other sites More sharing options...
picyka Posted November 24, 2023 Share Posted November 24, 2023 10 minutes ago, Sherzod said: Você está usando ícones FontAwesome? yes Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 24, 2023 Share Posted November 24, 2023 23 minutes ago, picyka said: yes Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 24, 2023 Share Posted November 24, 2023 One possible solution: 1. UniDBGrid.ClientEvents.ExtEvents -> function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { dataColIndx = 0; actionColIndx = 6; actionItemsIndx = 0; columns[actionColIndx].items[actionItemsIndx].getClass = function (value, metadata, record) { var cssColorClass = ""; if (record.data[dataColIndx] >= 0 && record.data[dataColIndx] <= 1500) { cssColorClass = " greenColor" } else if (record.data[dataColIndx] > 1500) { cssColorClass = " orangeColor" } return columns[actionColIndx].items[actionItemsIndx].iconCls + " x-uni-action-cls" + cssColorClass; } } 2. CustomCSS -> .greenColor { color: green } .orangeColor { color: orange } Quote Link to comment Share on other sites More sharing options...
picyka Posted November 24, 2023 Share Posted November 24, 2023 Thanks, I'll test it here. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 24, 2023 Share Posted November 24, 2023 Okay. Quote Link to comment Share on other sites More sharing options...
picyka Posted November 24, 2023 Share Posted November 24, 2023 It worked, thanks JsMan. 1 Quote Link to comment Share on other sites More sharing options...
picyka Posted November 24, 2023 Share Posted November 24, 2023 The only doubt I had, for me to use the field in the rule, does this field need to be added to the grid? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 24, 2023 Share Posted November 24, 2023 1 hour ago, picyka said: The only doubt I had, for me to use the field in the rule, does this field need to be added to the grid? Yes. 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.