extnet / Ext.NET

35 stars 41 forks source link

absent: ext-column's Renderer inner property #1738

Open fabriciomurta opened 4 years ago

fabriciomurta commented 4 years ago

The ext-column component ignores a Renderer inner property. Whilst it does not prevent the page from rendering at all, the renderer code won't get rendered to the component (as if it weren't specified).

Issue explored at gridpanel/arraygrid/simple/index.cshtml#L91.

Examples referencing the feature

WebForms examples matching <ext:Column and <Renderer

  1. Action > Basic > Grid
  2. Associations > HasMany > Lazy_Load
  3. Chart > Area > Basic
  4. Chart > Column > Stacked
  5. Chart > Column > Stacked_100
  6. Chart > Combination > Pareto
  7. Chart > Misc > ToolTips
  8. ColorPicker > Advanced > GridPanel
  9. Combination_Samples > Applications > Feed_Viewer
  10. Combination_Samples > Applications > Word_Wrench
  11. Data_Binding > Basic > Chaining_Stores
  12. Data_Binding > Basic > Isolated_Child_Sessions
  13. Desktop > Introduction > Overview
  14. DragDrop > Grid > Field_to_Grid
  15. Form > DropDownField > Overview
  16. Form > FormPanel > Basic
  17. Form > Triggers > Trigger_with_Dialog_Editor
  18. Getting_Started > Introduction > Component_Overview
  19. GridPanel > ArrayGrid > ArrayWithPaging
  20. GridPanel > ArrayGrid > ForceFit
  21. GridPanel > ArrayGrid > Keep_Page_on_Refresh
  22. GridPanel > ArrayGrid > PageProxy_with_DirectMethod
  23. GridPanel > ArrayGrid > Remote_Load
  24. GridPanel > ArrayGrid > Simple
  25. GridPanel > ColumnModel > Change_Models
  26. GridPanel > ColumnModel > Reconfigure
  27. GridPanel > Commands > Cell_Command
  28. GridPanel > Commands > Prepare_Commands
  29. GridPanel > ComponentColumn > Overview
  30. GridPanel > DataSource_Controls > LinqDataSource
  31. GridPanel > DataSource_Controls > ObjectDataSource
  32. GridPanel > DataSource_Controls > SqlDataSource
  33. GridPanel > Data_Presentation > Editor_Field_Mapping
  34. GridPanel > Data_Presentation > Field_Mapping
  35. GridPanel > Data_Presentation > MultiCombo_Map
  36. GridPanel > Editable > Editor_with_DirectMethod
  37. GridPanel > FilterHeader > Mapped_Field_Filtering
  38. GridPanel > FilterHeader > Overview
  39. GridPanel > FilterHeader > Remote
  40. GridPanel > Layout > FitLayout
  41. GridPanel > Locking_Grid > Cell_Editing
  42. GridPanel > Locking_Grid > GroupingSummary
  43. GridPanel > Locking_Grid > GroupingSummary_with_group_headers
  44. GridPanel > Locking_Grid > Simple
  45. GridPanel > Miscellaneous > ColumnHeaderGroup
  46. GridPanel > Miscellaneous > Custom_Column
  47. GridPanel > Miscellaneous > Custom_Data_Binding
  48. GridPanel > Miscellaneous > Custom_UI
  49. GridPanel > Miscellaneous > Details_Window
  50. GridPanel > Miscellaneous > Details_Window_Remote
  51. GridPanel > Miscellaneous > Export_Data_Ajax
  52. GridPanel > Miscellaneous > Export_Data_PostBack
  53. GridPanel > Miscellaneous > FilterQuery
  54. GridPanel > Miscellaneous > Generic_List
  55. GridPanel > Miscellaneous > Grouping
  56. GridPanel > Miscellaneous > Grouping_TotalRow
  57. GridPanel > Miscellaneous > JSONP_Proxy
  58. GridPanel > Miscellaneous > Numbered_Rows
  59. GridPanel > Miscellaneous > Save_Filter
  60. GridPanel > MultiHeader > Filter
  61. GridPanel > Paging_and_Sorting > DirectMethod
  62. GridPanel > Paging_and_Sorting > Multiple_Sorting_Local
  63. GridPanel > Paging_and_Sorting > Page
  64. GridPanel > Plugins > GridFilters_Local
  65. GridPanel > Plugins > GridFilters_Remote
  66. GridPanel > Plugins > GroupingSummary
  67. GridPanel > Plugins > GroupPaging
  68. GridPanel > Plugins > LiveSearch
  69. GridPanel > Plugins > Remote_GroupSummary
  70. GridPanel > Plugins > Selection_Memory
  71. GridPanel > Plugins > SlidingPager
  72. GridPanel > Plugins > Summary
  73. GridPanel > Restful > Overview
  74. GridPanel > RowExpander > Local_Mode
  75. GridPanel > RowExpander > Remote_Mode
  76. GridPanel > RowExpander > Shared_Component
  77. GridPanel > Selection_Models > Cell_Selection
  78. GridPanel > Selection_Models > Checkbox_Selection
  79. GridPanel > Selection_Models > Row_Selection
  80. GridPanel > Selection_Models > Submitting_Values
  81. GridPanel > Spreadsheet > Clipboard
  82. GridPanel > System.Data > DataTable
  83. GridPanel > Update > AutoSave
  84. GridPanel > Update > Batch
  85. Keys > Panel_Keys > Grid_Rows_Delete
  86. Kitchen_Sink > GridPanels > Grouped_Header_GridPanel
  87. MessageBox > Callout > Delegation
  88. Miscellaneous > Mouse_Distance_Sensor > Basic
  89. Miscellaneous > Store > ClientStore
  90. Miscellaneous > ToolTips > GridPanel_Cell_Tooltip
  91. Miscellaneous > ToolTips > GridPanel_Row_Tooltip
  92. TreePanel > Advanced > Buffer_Rendered_TreeGrid
  93. TreePanel > Advanced > Locking_Buffer_Rendered_TreeGrid

MVC examples matching \.Column\(.*\.Renderer\(

(renderers necessarily pertaining the column)

  1. Actions > Grid
  2. Data > Basic > ModelSerializer
  3. DragDrop > Grid > Field_to_Grid
  4. Form > FormPanel > Basic
  5. GridPanel > ArrayGrid > ArrayWithPaging
  6. GridPanel > ArrayGrid > Remote_Load
  7. GridPanel > ArrayGrid > Simple
  8. GridPanel > ColumnModel > Ajax_Configuration
  9. GridPanel > FilterHeader > Overview
  10. GridPanel > Miscellaneous > FilterQuery
  11. GridPanel > Plugins > GridFilters_Local
  12. GridPanel > Plugins > GridFilters_Remote
  13. GridPanel > RowExpander > Component
  14. GridPanel > RowExpander > Local_Mode
  15. GridPanel > RowExpander > Remote_Mode
  16. Miscellaneous > Mouse_Distance_Sensor > Basic
  17. Miscellaneous > Store > ClientStore
AndreyChechel commented 4 years ago

The renderer property is available as an <ext-column /> element attribute.

Actual

<Columns>
    <ext-column Text="Company" DataIndex="company" Flex="1" />
    <ext-column Text="Price" DataIndex="price">
        <Renderer Format="UsMoney" />
    </ext-column>
    <ext-column Text="Change" DataIndex="change">
        <Renderer Fn="change" />
    </ext-column>
    <ext-column Text="Change" DataIndex="pctChange">
        <Renderer Fn="pctChange" />
    </ext-column>
    <ext-datecolumn Text="Last Updated" DataIndex="lastChange" Width="120" />
</Columns>

Revised

<Columns>
    <ext-column Text="Company" DataIndex="company" Flex="1" />
    <ext-column Text="Price" DataIndex="price" renderer="Ext.util.Format.usMoney" />
    <ext-column Text="Change" DataIndex="change" renderer="change" />
    <ext-column Text="Change" DataIndex="pctChange" renderer="pctChange" />
    <ext-datecolumn Text="Last Updated" DataIndex="lastChange" Width="120" />
</Columns>
fabriciomurta commented 4 years ago

For the record, scenarios like this:

<Columns>
    <ext:Column
        runat="server"
        Flex="1"
        Editor="true"
        DataIndex="Value">
        <Renderer Handler="metadata.style='color:gray;'; return '[none]';" />
    </ext:Column>
</Columns>

Will have to be expressed as:

<columns>
    <ext-column
        flex="1"
        editor="true"
        dataIndex="Value"
        renderer="function (value, metadata, record, rowIndex, colIndex, store, view) { metadata.style='color:gray;'; return '[none]'; }"
        />
</columns>

In other words, the function arguments will have to be expressed all the time. Although similar to declaring the function itself, it means there's no longer a shorthand for that as Ext.NET 5's <Renderer Handler="..." /> did.

Basically there are five different argument sets to renderer throughout Ext.NET at least as far as WebForms Examples Explorer uses of Renderer within:

geoffreymcgill commented 4 years ago

Using an inner <renderer> with the fn attribute would be preferred, although this does not appear to be currently supported.

<ext-column
    flex="1"
    editor="true"
    dataIndex="Value">
    <renderer fn="function (value, metadata, record, rowIndex, colIndex, store, view) { metadata.style='color:gray;'; return '[none]'; }" />
</ext-column>