Table data display method and device, equipment, medium and computer program product
By iteratively processing the source data set and determining the table column width to avoid line wrapping of cell content, the problem of poor table data display in the prior art is solved, and table data display without line wrapping is realized.
Patent Information
- Application Number
- CN202410930212.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-09-27
AI Technical Summary
When existing UI components display table data, if there are too many columns in the table or too much cell text content, the cell content in the table will wrap, affecting the display effect.
By iteratively processing the source data set, obtain the element width of each source element, and determine the column width based on the maximum element width or its product and adjustment coefficient, ensuring that the table column width is greater than or equal to the element width, thereby avoiding cell content wrapping.
It effectively improves the display effect of table data, ensures that no line breaks occur in data of any type and size, and improves the quality of table display.
Smart Images

Figure CN118709669A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data presentation, and in particular to a table data presentation method, apparatus, device, medium and computer program product. Background Art
[0002] UI (User Interface) design refers to the overall design of human-computer interaction, operating logic, and interface aesthetics for products such as software, websites, and mobile applications.
[0003] The UI components provided by the relevant technology can meet most of the common business needs of users. However, it is found in the application that when displaying table data on the page based on the existing UI components, if the table data has a large number of columns, or some cells in the table have a lot of text content, it will cause the cell content in the table to wrap, which makes the display effect of the table data poor. Summary of the invention
[0004] The purpose of the present disclosure is to provide a table data display method, device and related equipment to solve the technical problem that the display effect of table data in related technologies is poor.
[0005] In a first aspect, the present disclosure provides a method for displaying table data, the method comprising:
[0006] Iteratively process N groups of source data sets to obtain N column widths, where the N column widths correspond to the N groups of source data sets one by one, and N is a positive integer;
[0007] In the target page, setting the table column width of the corresponding source data set based on the column width, and forming a target table including the N groups of source data sets;
[0008] The i-th iteration in the iterative process includes:
[0009] Obtaining the element width of each source element in the source data set of the i-th iteration, where the element width is the text width of the corresponding source element after page rendering;
[0010] Based on at least one element width corresponding to the source data set of the i-th iteration, the column width corresponding to the source data set of the i-th iteration is determined, and the column width corresponding to the source data set of the i-th iteration is greater than or equal to the largest element width of at least one element width corresponding to the source data set of the i-th iteration, and i is a positive integer less than or equal to N.
[0011] In a second aspect, the present disclosure provides a table data display device, the device comprising:
[0012] A processing module, configured to iteratively process N groups of source data sets to obtain N column widths, wherein the N column widths correspond to the N groups of source data sets one by one, and N is a positive integer;
[0013] A table display module, used for setting the table column width of the corresponding source data set based on the column width in the target page, and forming a target table including the N groups of source data sets;
[0014] The i-th iteration in the iterative process includes:
[0015] Obtaining the element width of each source element in the source data set of the i-th iteration, where the element width is the text width of the corresponding source element after page rendering;
[0016] Based on at least one element width corresponding to the source data set of the i-th iteration, the column width corresponding to the source data set of the i-th iteration is determined, and the column width corresponding to the source data set of the i-th iteration is greater than or equal to the largest element width of at least one element width corresponding to the source data set of the i-th iteration, and i is a positive integer less than or equal to N.
[0017] In a third aspect, the present disclosure provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method described in the first aspect when executed by the processor.
[0018] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0019] In a fifth aspect, the present disclosure provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0020] In the present disclosure, by iteratively processing N groups of source data sets, the text width of each source element in each group of source data sets after page rendering is obtained, and the column width of the corresponding source data set is determined accordingly, and then the width of the corresponding column of the source data set in the table is set according to the column width, and finally a target table is formed. Since the width of each column of the target table is greater than or equal to the text width of each element in the corresponding source data set when displayed, the cell content in the table can be avoided from wrapping, which can improve the display effect of the table data. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a flowchart of a table data display method provided by an embodiment of the present disclosure;
[0022] Figure 2 is a schematic diagram of a target table scrolling display provided by an embodiment of the present disclosure;
[0023] Figure 3 is a flow chart of a width calculation mode provided by an embodiment of the present disclosure;
[0024] Figure 4 is a flowchart of another width calculation mode provided by an embodiment of the present disclosure;
[0025] Figure 5 It is a structural schematic diagram of a table data display device provided by an embodiment of the present disclosure;
[0026] Figure 6 It is a schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0028] The present disclosure provides a method for displaying table data. Figure 1 As shown, the table data display method includes:
[0029] Step 101: Iteratively process N groups of source data sets to obtain N column widths.
[0030] The N column widths correspond one-to-one to the N groups of source data sets, and N is a positive integer.
[0031] The i-th iteration in the iterative process includes:
[0032] Obtaining the element width of each source element in the source data set of the i-th iteration, where the element width is the text width of the corresponding source element after page rendering;
[0033] The column width corresponding to the source data set of the i-th iteration is determined based on at least one element width corresponding to the source data set of the i-th iteration, where i is a positive integer less than or equal to N.
[0034] The column width corresponding to the source data set of the i-th iteration is greater than or equal to the largest element width among at least one element width corresponding to the source data set of the i-th iteration.
[0035] Exemplarily, the largest element width among at least one element width corresponding to the source data set of the i-th iteration may be directly determined as the column width corresponding to the source data set of the i-th iteration;
[0036] Alternatively, the product of the largest element width among at least one element width corresponding to the source data set of the i-th iteration and a preset adjustment coefficient may be determined as the column width corresponding to the source data set of the i-th iteration, and the preset adjustment coefficient is greater than 1;
[0037] The sum of the maximum element width among at least one element width corresponding to the source data set of the i-th iteration and a preset adjustment width may also be determined as the column width corresponding to the source data set of the i-th iteration, where the preset adjustment width is a positive number;
[0038] Furthermore, a sum calculation may be performed on at least one element width corresponding to the source data set of the i-th iteration, and the calculated sum value may be determined as the column width corresponding to the source data set of the i-th iteration.
[0039] The source data set may be understood as a set of business data obtained from a backend database or a cloud server and to be displayed using a table style. A set of source data sets corresponds to a column of elements in a table.
[0040] Exemplarily, the business data set may be used to indicate user identity information, product specification information, and the like.
[0041] The above page rendering operation for the source element can be:
[0042] In the case that there is no matching mapping data for the source element, the source element is rendered on the page according to preset rendering properties (such as font, font size, etc.) to form a first page element. At this time, the element width of the first page element formed is the text width of the source element after page rendering;
[0043] In the case where there is matching mapping data for the source element, the element content of the source element is first determined according to the mapping data, and then the determined element content is rendered on the page according to the preset rendering attribute to form a second page element. At this time, the element width of the formed second page element is the text width of the source element after page rendering;
[0044] The mapping data is used to associate the source element with the corresponding element content. Based on the mapping data, the data size of the source element stored in the backend database or cloud server can be reduced. For example, for the text "internal employees" and "outsourced employees", the mapping data [1, "internal employees"], [2, "outsourced employees"] can be constructed respectively. At this time, "1" and "2" can be understood as the aforementioned source elements, and "internal employees" and "outsourced employees" can be understood as the aforementioned element contents;
[0045] In the present application, source elements that do not have matching mapping data can be classified as static type elements, while source elements that have matching mapping data can be classified as dynamic type elements. The above-mentioned preset rendering attributes can be adaptively set according to actual conditions, and the present application does not limit the specific content of the preset rendering attributes.
[0046] Step 102: In the target page, the table column width corresponding to the source data set is set based on the column width, and a target table including the N groups of source data sets is formed.
[0047] In the present disclosure, by iteratively processing N groups of source data sets, the text width of each source element in each group of source data sets after page rendering is obtained, and the column width of the corresponding source data set is determined accordingly, and then the width of the corresponding column of the source data set in the table is set according to the column width, and finally a target table is formed. Since the width of each column of the target table is greater than or equal to the text width of each element in the corresponding source data set when displayed, the line break of the cell content in the table can be avoided, which can improve the display effect of the table data.
[0048] Specifically, through the application of the method described in the present application, data of any type and size can be displayed without line breaks in a table.
[0049] In one embodiment, obtaining the element width of each source element in the source data set of the i-th iteration includes:
[0050] Traversing the M source elements included in the source data set of the i-th iteration to obtain the element width of each source element in the source data set of the i-th iteration, where M is a positive integer;
[0051] The j-th traversal in the i-th iteration includes, j is a positive integer less than or equal to M:
[0052] Creating a target element in the target page;
[0053] Taking the jth source element in the source data set of the i-th iteration as the input text of the target element, performing page rendering on the target element, and determining the width of the target element after the page rendering as the element width of the jth source element in the source data set of the i-th iteration;
[0054] Delete the target element on the target page.
[0055] By iteratively executing actions such as creation, rendering, and deletion of target elements, the element width of each source element in N source data sets can be quickly obtained, thereby improving the efficiency of forming the target table.
[0056] It should be understood that the execution of this embodiment requires that each source element in the N source data sets is an element of a static type.
[0057] Furthermore, the target element is an element in the target page that meets a preset condition;
[0058] The preset condition includes at least one of the following:
[0059] The element's transparency is 0;
[0060] The display position of the element is outside the display area of the target page;
[0061] The global attribute of an element is hidden.
[0062] In this embodiment, preset conditions are set to avoid visual display of the target element in the target page, hide the element changes in the above iteration process, and enable the target page to maintain a better page display effect.
[0063] Exemplarily, setting the global attribute of the target element to a hidden attribute may include: setting the Display attribute of the target element to "none", or setting the visibility attribute of the target element to "hidden".
[0064] In one embodiment, before iteratively processing the N groups of source data sets to obtain N column widths, the method further includes:
[0065] In the target page, an initial table is formed based on a preset table display rule and N sets of source data sets;
[0066] The obtaining the element width of each source element in the source data set of the i-th iteration includes:
[0067] Obtaining the element width of each source element in the initial table in the source data set of the i-th iteration;
[0068] The step of setting the table column width of the corresponding source data set based on the column width in the target page and forming a target table including the N groups of source data sets includes:
[0069] On the target page, the table column width of the corresponding source data set in the initial table is adjusted based on the column width to obtain the target table.
[0070] The preset table display rules may be understood as table display rules formed based on relevant technologies. For example, the initial table may be understood as a table formed by displaying N groups of source data sets in columns based on the ElementPlus tool.
[0071] In this embodiment, an initial table is first formed based on preset table display rules and N groups of source data sets; then, the element width of each source element in the N groups of source data sets is obtained accordingly according to the initial table to adapt to the page rendering requirements of any type of source elements, making the acquisition of the element width of each source element in the N groups of source data sets more flexible.
[0072] It should be understood that the execution of this embodiment does not limit the data type of the source elements, that is, the source elements in the N groups of source data sets can all be static type elements; or some can be static type elements and some can be dynamic type elements; or all can be dynamic type elements.
[0073] In some implementations, the initial table may be set as a hidden table, for example, the transparency of the initial table may be set to 0, or the global attribute of the initial table may be set to a hidden attribute;
[0074] After batch adjusting the table column widths of the corresponding N groups of source data sets in the initial table based on the N column widths to obtain the target table, the target table is unhidden to hide the table change content from the initial table to the target table, so that the target page can maintain a better page display effect.
[0075] In one embodiment, the iterative processing of N groups of source data sets to obtain N column widths includes:
[0076] When it is detected that the table data set meets the change condition, iterative processing is performed on N groups of source data sets included in the table data set to obtain N column widths;
[0077] The change condition includes at least one of the following:
[0078] The table data set triggers a paging instruction;
[0079] The table data set triggers a data adding instruction;
[0080] The table data set triggers a data deletion instruction;
[0081] The table data set triggers a data change instruction.
[0082] By setting the change conditions and monitoring the table data set accordingly to match the changes in the table data in the actual business scenario, the cell width of the final displayed table can be adaptively matched to the table content automatically under any circumstances.
[0083] The table data set may be understood as a set of multiple data to be displayed in the table display area of the target page.
[0084] The situation in which the above-mentioned table data set triggers a paging instruction is: when multiple recalled data are obtained in response to a user query instruction, and the above-mentioned table display area can only display part of the multiple recalled data, the multiple recalled data will be displayed in pages. When the user clicks the page switching button, it is considered that the table data set triggers the paging instruction. At this time, the update operation of the table data set will be executed based on the page number switched by the user.
[0085] Correspondingly, when a user performs a data adding / deleting / changing operation on a table data set, it is considered that the table data set triggers a data adding instruction / data deleting instruction / data changing instruction.
[0086] Exemplarily, the table data set may be monitored by a watch function.
[0087] In one embodiment, after setting the table column width of the corresponding source data set based on the column width in the target page and forming a target table including the N groups of source data sets, the method further includes:
[0088] When the table area of the target table is larger than the area of the table display area in the target page, the target table is scrolled and displayed in the table display area.
[0089] In the application, due to the large number of columns of table data, or the large amount of text content in some cells of the table, the table area of the target table may be larger than the area of the table display area in the target page. In this case, based on the scrolling display of the target table, the entire content of the target table can be fully displayed (meaning that the user can obtain the entire content of the target table by dragging the table scroll bar) while ensuring that the cell content in the target table does not wrap.
[0090] For example, Figure 2 As shown, Figure 2 The dotted box in the middle indicates the table display area. Figure 2 The solid line box indicates the target table; it should be understood that when the target table is scrolled and displayed in the table display area, at least one of the vertical scroll bar and the horizontal scroll bar exists.
[0091] For ease of understanding, take the encapsulation settings of the el-table component in the Element Plus tool as an example, as follows:
[0092] The component formed by encapsulating the el-table component is defined as the wq-table component. The input parameters of the wq-table component include three items: tableData, columns, and calcType. Among them, tableData is used to represent table data (that is, the aforementioned table data set), columns is used to represent table column attributes, and calcType is used to represent the width calculation mode used by the wq-table component. The width calculation mode includes mode 1 and mode 2.
[0093] Same pattern Figure 3 As shown, the specific process is:
[0094] First, columns are processed based on the v-for loop to dynamically generate multiple el-table-columns, and then multiple columns elements are obtained based on multiple el-table-columns. Each columns element includes three attributes, namely, the prop attribute indicating the column attribute (corresponding to the prop of el-table-column), the label indicating the column name (corresponding to the label of el-table-column), and the attribute value or attribute value set associated with the corresponding column in tableData.
[0095] The watch function is used to monitor changes in tableData. When tableData changes (which can be understood as monitoring that the table data set meets the change conditions), the width of each column is calculated as follows:
[0096] Traverse each column item of the table data tableData, obtain the calcProps in the corresponding columns element, and obtain all the values of each column item through calcProps (all the values of each item here can be understood as the aforementioned N groups of source data sets). At this point, the string to be displayed in each column in the table is obtained;
[0097] Then use the getTextWidth function to get the text width of these values, and finally calculate the maximum text width (i.e. column width) corresponding to each item.
[0098] The processing flow of the getTextWidth function is: create a new div element (which can be understood as the aforementioned target element), and set its text content to the input text (that is, a value among all the values of a column item, that is, the aforementioned source element), add a specific class name (__get_width__) to the div element, and adaptively set the element style so that its position is fixed outside the edge of the screen (referring to the display position outside the display area of the target page), and the transparency is 0 (that is, invisible); then add this div element to the body, get the rendered width of the div, and remove it from the body, and finally return the width. The returned width is the width of the corresponding input text, that is, the element width of the source element.
[0099] It should be understood that the execution of the getTextWidth function is to complete the rendering in the invisible part of the page and obtain the real width of each string.
[0100] After completing the above traversal, the largest width among the multiple widths returned for each column item is set as the min-width attribute of the corresponding column item, and the target table is formed accordingly.
[0101] Mode 2 Figure 4 As shown, the specific process is:
[0102] First, the page is rendered according to the el-table component to obtain the aforementioned initial table. Each cell in the initial table includes an element with a class name of .cell. The white-space and overflow properties of CSS (Cascading Style Sheets) are used to set it to not allow line breaks and scroll beyond the limit.
[0103] Then, based on the pre-defined v-width instruction bound to the el-table component, the width processing action is performed based on the component mounted hook function;
[0104] The width processing operation includes:
[0105] Get the .cell element object in the initial table through querySelectorAll(), and get the actual DOM (Document Object Model) rendering width (i.e. the element width of the corresponding source element in the initial table) through the scrollWidth property of the .cell element object, and then calculate the maximum width of each column based on the width of all DOM elements in each column;
[0106] Select the corresponding col element through the CSS attribute selector, and assign the maximum width of each column calculated above to the width attribute of the corresponding col element, so as to complete the width adjustment of the initial table. The adjusted initial table is the target table.
[0107] It should be noted that Model 1 is suitable for scenarios where the cell width can be determined by the field values in the table data (i.e., when the field values in the table data are all static types), and its table generation efficiency is better than that of Model 2.
[0108] Mode 2 is applicable to scenarios where the cell width needs to be determined based on the width of the actual rendered content (i.e., the field values in the table data include dynamic field values). Its application scenarios are wider than those of Mode 2.
[0109] Users can adaptively select mode 1 or mode 2 according to actual needs to complete the adaptive adjustment of the table width, thereby avoiding line breaks in the cell contents of the table.
[0110] See also Figure 5 , Figure 5 is a table data display device provided by an embodiment of the present disclosure, such as Figure 5 As shown, the table data display device 500 includes:
[0111] The processing module 501 is used to iteratively process N groups of source data sets to obtain N column widths, where the N column widths correspond to the N groups of source data sets one by one, and N is a positive integer;
[0112] A table display module 502 is used to set the table column width of the corresponding source data set based on the column width in the target page, and form a target table including the N groups of source data sets;
[0113] The i-th iteration in the iterative process includes:
[0114] Obtaining the element width of each source element in the source data set of the i-th iteration, where the element width is the text width of the corresponding source element after page rendering;
[0115] Based on at least one element width corresponding to the source data set of the i-th iteration, the column width corresponding to the source data set of the i-th iteration is determined, and the column width corresponding to the source data set of the i-th iteration is greater than or equal to the largest element width of at least one element width corresponding to the source data set of the i-th iteration, and i is a positive integer less than or equal to N.
[0116] In one embodiment, obtaining the element width of each source element in the source data set of the i-th iteration includes:
[0117] Traversing the M source elements included in the source data set of the i-th iteration to obtain the element width of each source element in the source data set of the i-th iteration, where M is a positive integer;
[0118] The j-th traversal in the i-th iteration includes, j is a positive integer less than or equal to M:
[0119] Creating a target element in the target page;
[0120] Taking the jth source element in the source data set of the i-th iteration as the input text of the target element, performing page rendering on the target element, and determining the width of the target element after the page rendering as the element width of the jth source element in the source data set of the i-th iteration;
[0121] Delete the target element on the target page.
[0122] Furthermore, the target element is an element in the target page that meets a preset condition;
[0123] The preset condition includes at least one of the following:
[0124] The element's transparency is 0;
[0125] The display position of the element is outside the display area of the target page;
[0126] The global attribute of an element is hidden.
[0127] In one embodiment, the table data display device 500 further includes:
[0128] An initial table forming module, used to form an initial table in the target page based on a preset table display rule and N sets of source data sets;
[0129] The obtaining of the element width of each source element in the source data set of the i-th iteration includes: obtaining the element width of each source element in the source data set of the i-th iteration in the initial table;
[0130] The table display module 502 is specifically used for:
[0131] On the target page, the table column width of the corresponding source data set in the initial table is adjusted based on the column width to obtain the target table.
[0132] In one embodiment, the processing module 501 is specifically configured to:
[0133] When it is detected that the table data set meets the change condition, iterative processing is performed on N groups of source data sets included in the table data set to obtain N column widths;
[0134] The change condition includes at least one of the following:
[0135] The table data set triggers a paging instruction;
[0136] The table data set triggers a data adding instruction;
[0137] The table data set triggers a data deletion instruction;
[0138] The table data set triggers a data change instruction.
[0139] In one embodiment, the table data display device 500 further includes:
[0140] The display module is used for scrolling and displaying the target table in the table display area when the table area of the target table is larger than the area of the table display area in the target page.
[0141] The table data display device 500 provided in the embodiment of the present disclosure can implement each process in the above table data display method embodiment, and will not be described again here to avoid repetition.
[0142] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0143] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0144] like Figure 6As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 to a random access memory (RAM) 603. In RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, ROM 602 and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0145] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0146] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSP), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the table data display method. For example, in some embodiments, the table data display method may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the table data display method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the table data presentation method in any other appropriate manner (for example, by means of firmware).
[0147] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs, which may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, which may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0148] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0149] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0150] As used herein, the term "machine-readable medium" refers to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0151] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0152] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0153] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0154] The present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the above Figure 1 , Figure 3 or Figure 4The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0155] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of this disclosure can be achieved, and this document is not limited here.
[0156] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for displaying tabular data, characterized in that: The method comprises: Iteratively process N groups of source data sets to obtain N column widths, where the N column widths correspond to the N groups of source data sets one by one, and N is a positive integer; In the target page, setting the table column width of the corresponding source data set based on the column width, and forming a target table including the N groups of source data sets; The i-th iteration in the iterative process includes: Obtaining the element width of each source element in the source data set of the i-th iteration, where the element width is the text width of the corresponding source element after page rendering; Based on at least one element width corresponding to the source data set of the i-th iteration, the column width corresponding to the source data set of the i-th iteration is determined, and the column width corresponding to the source data set of the i-th iteration is greater than or equal to the largest element width of at least one element width corresponding to the source data set of the i-th iteration, and i is a positive integer less than or equal to N.
2. The method according to claim 1, characterized in that The obtaining the element width of each source element in the source data set of the i-th iteration includes: Traversing the M source elements included in the source data set of the i-th iteration to obtain the element width of each source element in the source data set of the i-th iteration, where M is a positive integer; The j-th traversal in the i-th iteration includes, j is a positive integer less than or equal to M: Creating a target element in the target page; Taking the jth source element in the source data set of the i-th iteration as the input text of the target element, performing page rendering on the target element, and determining the width of the target element after the page rendering as the element width of the jth source element in the source data set of the i-th iteration; Delete the target element on the target page.
3. The method according to claim 2, characterized in that The target element is an element in the target page that meets a preset condition; The preset condition includes at least one of the following: The element's transparency is 0; The display position of the element is outside the display area of the target page; The global attribute of an element is the hidden attribute.
4. The method according to claim 1, characterized in that: Before iteratively processing the N groups of source data sets to obtain N column widths, the method further includes: In the target page, an initial table is formed based on a preset table display rule and N sets of source data sets; The obtaining of the element width of each source element in the source data set of the i-th iteration includes: obtaining the element width of each source element in the source data set of the i-th iteration in the initial table; The step of setting the table column width of the corresponding source data set based on the column width in the target page and forming a target table including the N groups of source data sets includes: On the target page, the table column width of the corresponding source data set in the initial table is adjusted based on the column width to obtain the target table.
5. The method according to any one of claims 1 to 4, characterized in that The iterative processing of N groups of source data sets to obtain N column widths includes: When it is detected that the table data set meets the change condition, iterative processing is performed on N groups of source data sets included in the table data set to obtain N column widths; The change condition includes at least one of the following: The table data set triggers a paging instruction; The table data set triggers a data adding instruction; The table data set triggers a data deletion instruction; The table data set triggers a data change instruction.
6. The method according to any one of claims 1 to 4, characterized in that After setting the table column width of the corresponding source data set based on the column width in the target page and forming a target table including the N groups of source data sets, the method further includes: When the table area of the target table is larger than the area of the table display area in the target page, the target table is scrolled and displayed in the table display area.
7. A tabular data display device, characterized in that: The device comprises: A processing module, configured to iteratively process N groups of source data sets to obtain N column widths, wherein the N column widths correspond to the N groups of source data sets one by one, and N is a positive integer; A table display module, used for setting the table column width of the corresponding source data set based on the column width in the target page, and forming a target table including the N groups of source data sets; The i-th iteration in the iterative process includes: Obtaining the element width of each source element in the source data set of the i-th iteration, where the element width is the text width of the corresponding source element after page rendering; Based on at least one element width corresponding to the source data set of the i-th iteration, the column width corresponding to the source data set of the i-th iteration is determined, and the column width corresponding to the source data set of the i-th iteration is greater than or equal to the largest element width of at least one element width corresponding to the source data set of the i-th iteration, and i is a positive integer less than or equal to N.
8. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method according to any one of claims 1 to 6 when executed by the processor.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 6.
