MSMK Posted August 15, 2021 Author Share Posted August 15, 2021 9 hours ago, Sherzod said: procedure TMainForm.UniFormShow(Sender: TObject); begin cdsData.close; cdsData.createDataSet; cdsData.Append; cdsDataCustomVariant.AsInteger := 1; cdsDataDocVariant.AsInteger := 1; cdsDatainvisibleCol.AsInteger := 1; //<--------- cdsData.Post; ... function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var widgetColIndx=0; var inVisibleColIndx=2; columns[inVisibleColIndx].hideable=false; columns[widgetColIndx].onWidgetAttach = function(column, widget, record) { widget.setVisible(record.get(inVisibleColIndx) != 0); }; } Спасибо! я думал обойдется без костыля) Quote Link to comment Share on other sites More sharing options...
MSMK Posted August 15, 2021 Author Share Posted August 15, 2021 10 hours ago, Sherzod said: procedure TMainForm.UniFormShow(Sender: TObject); begin cdsData.close; cdsData.createDataSet; cdsData.Append; cdsDataCustomVariant.AsInteger := 1; cdsDataDocVariant.AsInteger := 1; cdsDatainvisibleCol.AsInteger := 1; //<--------- cdsData.Post; ... function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var widgetColIndx=0; var inVisibleColIndx=2; columns[inVisibleColIndx].hideable=false; columns[widgetColIndx].onWidgetAttach = function(column, widget, record) { widget.setVisible(record.get(inVisibleColIndx) != 0); }; } что если прописать используя JSConfig размеры иконки 16х16 Quote Link to comment Share on other sites More sharing options...
MSMK Posted August 15, 2021 Author Share Posted August 15, 2021 9 minutes ago, =GGG= said: что если прописать используя JSConfig размеры иконки 16х16 .x-btn-icon-el-grid-cell-small { width: 16px !important; height: 16px !important; } Quote Link to comment Share on other sites More sharing options...
MSMK Posted August 15, 2021 Author Share Posted August 15, 2021 10 hours ago, Sherzod said: procedure TMainForm.UniFormShow(Sender: TObject); begin cdsData.close; cdsData.createDataSet; cdsData.Append; cdsDataCustomVariant.AsInteger := 1; cdsDataDocVariant.AsInteger := 1; cdsDatainvisibleCol.AsInteger := 1; //<--------- cdsData.Post; ... function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var widgetColIndx=0; var inVisibleColIndx=2; columns[inVisibleColIndx].hideable=false; columns[widgetColIndx].onWidgetAttach = function(column, widget, record) { widget.setVisible(record.get(inVisibleColIndx) != 0); }; } как обратиться к столбцу по имени, а не по индексу, так как при переносе столбцов по гриду сбиваются индексы Quote Link to comment Share on other sites More sharing options...
MSMK Posted August 15, 2021 Author Share Posted August 15, 2021 19 minutes ago, =GGG= said: как обратиться к столбцу по имени, а не по индексу, так как при переносе столбцов по гриду сбиваются индексы function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var findColumnIndex = function(columns, dataIndex) { var index; for (index = 0; index < columns.length; ++index) { if (columns[index].dataIndex == dataIndex) { break; } } return index == columns.length ? -1 : index; } var widgetColIndx1=0; var widgetColIndx2=findColumnIndex(columns, 'DocVariant'); columns[widgetColIndx1].onWidgetAttach = function(column, widget, record) { widget.setVisible(record.get(widgetColIndx1) != 0); }; columns[widgetColIndx2].onWidgetAttach = function(column, widget, record) { widget.setVisible(record.get(widgetColIndx2) != 1); }; } не помогло Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 15, 2021 Share Posted August 15, 2021 9 hours ago, =GGG= said: что если прописать используя JSConfig размеры иконки 16х16 1. CustomCSS: .customGrid .x-btn-icon-el { width: 16px; height: 16px; } 2. UniDBGrid -> LayoutConfig -> Cls = customGrid Quote Link to comment Share on other sites More sharing options...
MSMK Posted August 16, 2021 Author Share Posted August 16, 2021 21 hours ago, =GGG= said: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var findColumnIndex = function(columns, dataIndex) { var index; for (index = 0; index < columns.length; ++index) { if (columns[index].dataIndex == dataIndex) { break; } } return index == columns.length ? -1 : index; } var widgetColIndx1=0; var widgetColIndx2=findColumnIndex(columns, 'DocVariant'); columns[widgetColIndx1].onWidgetAttach = function(column, widget, record) { widget.setVisible(record.get(widgetColIndx1) != 0); }; columns[widgetColIndx2].onWidgetAttach = function(column, widget, record) { widget.setVisible(record.get(widgetColIndx2) != 1); }; } не помогло а как насчет этого? у меня проблема в случае переноса столбцов Quote Link to comment Share on other sites More sharing options...
MSMK Posted August 16, 2021 Author Share Posted August 16, 2021 13 hours ago, Sherzod said: 1. CustomCSS: .customGrid .x-btn-icon-el { width: 16px; height: 16px; } 2. UniDBGrid -> LayoutConfig -> Cls = customGrid Спасибо, с этим моментом разобрался Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 16, 2021 Share Posted August 16, 2021 1 hour ago, =GGG= said: а как насчет этого? у меня проблема в случае переноса столбцов Попробуйте проанализировать следующий подход: procedure TMainForm.UniFormCreate(Sender: TObject); begin grdData.JSInterface.JSAddListener( 'beforereconfigure', ' function(sender, store, columns){'+ ' columns[0].colName="'+ grdData.Columns[0].FieldName +'",'+ ' ...'+ ' }' ); end; Quote Link to comment Share on other sites More sharing options...
MSMK Posted August 16, 2021 Author Share Posted August 16, 2021 1 hour ago, Sherzod said: Попробуйте проанализировать следующий подход: procedure TMainForm.UniFormCreate(Sender: TObject); begin grdData.JSInterface.JSAddListener( 'beforereconfigure', ' function(sender, store, columns){'+ ' columns[0].colName="'+ grdData.Columns[0].FieldName +'",'+ ' ...'+ ' }' ); end; получается прописать имена столбцам вручную? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 16, 2021 Share Posted August 16, 2021 Да. Quote Link to comment Share on other sites More sharing options...
MSMK Posted August 16, 2021 Author Share Posted August 16, 2021 7 minutes ago, Sherzod said: Да. спасиб! попробую 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.