I have the following issue with PrimeFaces Sheet Component. I have moveble columns and rows. To some columns i have sortBy and filterBy. So, when i move one column, which doesn't have sortBy for example, by moving it the sortBy stays on its place and the previous column takes it. Which is wrong.
Do you have any idea how can i avoid this behaviour?
<pe:sheet id="sheet" widgetVar="sheetWidget" value="#{vertragspreiseForm.lazyModel.getPreiseList()}" var="row"
rowKey="#{row.pflegeartId}"
height="400"
resizableRows="true"
resizableCols="true"
fixedCols="2"
showColumnHeaders="true"
movableCols="true" movableRows="true">
Related
I use primefaces 8 and I have countries list diplayed with p:datatable with ascending mode :
<p:dataTable id="datalist"
widgetVar="dtCountries"
value="#{refCountriesController.items}" var="item"
rowsPerPageTemplate="10,20,30,40,50"
sortBy="#{item.libCountries}" sortMode="ascending" >
When I add (p:commandButton) row with Create Dialog form then I wish jump and display the page where is listed my added row, I can't find the solution, I have try this :
<p:commandButton oncomplete="PF('dtCountries').paginator.setPage( PF('dtCountries').paginator.getCurrentPage() ); "/>
how I can find the index of the page where my row is added ???
I need some help, thank you !
I have a SharePoint list as a datasource in Power Query.
It has a "AttachmentFiles" column, that is a table, in that table i want the values from the column "ServerRelativeURL".
I want to split that column so each value in "ServerRelativeURL"gets its own column.
I can get the values if i use the expand table function, but it will split it into multiple rows, I want to keep it in one row.
I only want one row per unique ID.
Example:
I can live with a fixed number of columns as there are usually no more than 3 attachments per ID.
I'm thinking that I can add a custom column that refers to "AttachmentFiles ServerRelativeURL Value(1)" but I don't know how.
Can anybody help?
Try this code:
let
fn = (x)=> {x, #table({"ServerRelativeUrl"},List.FirstN(List.Zip({{"a".."z"}}), x*2))},
Source = #table({"id", "AttachmentFiles"},{fn(2),fn(3),fn(1)}),
replace = Table.ReplaceValue(Source,0,0,(a,b,c)=>a[ServerRelativeUrl],{"AttachmentFiles"}),
cols = List.Transform({1..List.Max(List.Transform(replace[AttachmentFiles], List.Count))}, each "url"&Text.From(_)),
split = Table.SplitColumn(replace, "AttachmentFiles", (x)=>List.Transform({0..List.Count(x)-1}, each x{_}), cols)
in
split
I manged to solve it myself.
I added 3 custom columns like this
CustomColumn1: [AttachmentFiles]{0}
CustomColumn2: [AttachmentFiles]{1}
CustomColumn3: [AttachmentFiles]{2}
And expanded them with only the "ServerRelativeURL" selected.
It would be nice to have a dynamic solution. But this will work fine for now.
I am trying to create a Treeview - here is my code:
def treeview(self):
tree = Treeview(self.parent, columns=("no","name","props","subs", "summary"))
tree.heading('#0', text='No.')
tree.column('#0', width=100)
tree.heading('#1', text='Name')
tree.column('#1', width=100)
tree.heading('#2', text='Props')
tree.column('#2', width=100)
tree.heading('#3', text='Subs')
tree.column('#3', width=100)
tree.heading('#4', text='Summary')
tree.column('#4', width=100)
tree.place(relx=0.5,rely=0.2, anchor=CENTER)
There should be 5 columns - However, there is sixth blank column to the right of the last column. Why is this?
Also, how do I actually add text to each column? Thanks!
The 0'th column in a TreeView is always the "icon column" - see this manual page, where it says:
Your Treeview widget will be structured with multiple columns. The first column, which we'll call the icon column, displays the icons that collapse or expand items. In the remaining columns, you may display whatever information you like.
So my best guess would be that when you try to specify a label for column 0 Tk is adding one? (making the total 6).
As for adding text to the items of your Treeview.. Again, the manual page says:
Starting with the top-level entries, use the .insert() method to populate the tree. Each call to this method adds one item to the tree. Use the open keyword argument of this method to specify whether the item is initially expanded or collapsed.
If you want to supply the iid value for this item, use the iid keyword argument. If you omit this argument, ttk will make one up and return it as the result of the .insert() method call.
Which covers how to insert rows, then to "actually add text to each column":
values: This argument supplies the data items to be displayed in each column of the item. The values are supplied in logical column order. If too few values are supplied, the remaining columns will be blank in this item; if too many values are supplied, the extras will be discarded.
Thus, tree.insert(values=[3,"Fred",'prop','sub','guy named Fred']) would insert a row with the given values for the columns you have defined.
I give my client a template that they are supposed to populate and then they upload the spreadsheet and I read the file with cfspreadsheet in order to copy the data into a database table.
Pretty easy. The template has only one column in it. The client can not upload a sheet with more than one column in it. This used to work.
So the one column header is ING_CAS but when I read the file in with cfspreadsheet I get COL_2, COL_3, ING_CAS. So not only are the blank cells getting read they are also being given default names because of this attribute headerrow="1".
I'm at a loss here. I keep downloading the template and selecting the extraneous blank rows and columns and deleting them but I have no control over the file once the client gets it.
Is there some strange setting I am missing that will make cfspreadsheet ignore blank cells?
<cfspreadsheet action="read" src="#theFile#" query="SpreadSheetData" headerrow="1">
<cfdump var="#SpreadSheetData#" />
I ended up writing a helper function that stripped out COL_(n) columns.
<cffunction name="CleanExcelQuery" access="public" returntype="query" output="false" hint="Strips out blank column headers picked up on read.">
<cfargument name="SpreadSheetQuery" type="query" required="true" />
<cfset var theColumnHeaders = SpreadSheetQuery.columnList>
<cfset var theNewColumnHeaders = "">
<cfloop list="#theColumnHeaders#" index="h">
<cfif uCase(left(h, 4)) IS NOT "COL_">
<cfset theNewColumnHeaders = ListAppend( theNewColumnHeaders, h )>
</cfif>
</cfloop>
<cfquery name="newSpreadSheetQuery" dbtype="query">
Select #theNewColumnHeaders#
From SpreadSheetQuery
</cfquery>
<cfreturn newSpreadSheetQuery />
</cffunction>
cfspreadsheet only omits cells that are completely blank: no value or format (such as when you select a cell and use "clear all"). If it is picking up "extra" columns, it is because one or more of the cells in that column have a value or a custom cell format. Meaning they are not really "blank".
If you know the column position, you can use the columns attribute to only read only the values in that column. For example, to read column C:
<cfspreadsheet action="read"
src="c:/path/to/file.xls"
columns="3"
headerrow="1"
query="qResult" />
But I am not sure I understand why this is an issue. If you only need one column, simply ignore the other columns in your code. Can you elaborate on why this is causing an issue?
If you know which rows you want to read at all times you can use this:
<cfspreadsheet action="read" src="#path#" query="data" headerrow="1" excludeHeaderRow = "true" columns = "1-5" >
The above code reads columns 1 through 5. You can also use Leigh's solution to read the first 3 columns or you can do something like columns=1,3,6 (If I remember correct) to read from a custom range
The columns part read only the columns you want it to read without jumping around. I used this to read files that come from our clients and usually I get a few columns that are not "blank" due to their format.
You can also check the Cf documentation for cfspreadsheet just to see what other entries the 'column' option supports.
I'm trying to get the contents of a cell in a row in a YUI datatable.
I can use myDataTable.getSelectRows()[0] to get the first selected row. However, how do I get the contents of the first cell in that row?
It looks like getSelectRows() returns an array of record IDs. You can retrieve the corresponding record using getRecord(). Once you have a record, use getData() to retrieve the value of the field you are interested in.
var recordID = myDataTable.getSelectRows()[0],
record = myDataTable.getRecord(recordID);
console.log(record.getData("myField"));
http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_getRecord
http://developer.yahoo.com/yui/docs/YAHOO.widget.Record.html#method_getData
I think I may have the answer for you assuming you have not already found it yourself.
I have the same kind of page with a datatable and a textarea field, when you select a row in the datatable calls the same page displays further detail from the selected row in the textarea field and retains selection of the selected row.
1: To do this I apply the following example MySQL query called AllMyBroadcasts...
SELECT #rownum :=#rownum + 1 RowNumber, p.*
FROM tblBroadcasts p, (SELECT #rownum := 0)r
ORDER BY Date DESC
the tblBroadcasts table has fields : Date, Narrative, ID
2: I then provide the following to the table row of my YUI Datatable within HTML hyperlink tags.
href="MyPage.php?SelectedBroadcastID=' .$row_Broadcasts['ID'].'&RowNumber=' .($row_Broadcasts['RowNumber'] -1 )
3: When the href is clicked MyPage reload with additional parameters SelectedBroadcastID and RowNumber the SelectedBroadcastID I use in a second query against tblBroadcasts called MySlectedBroadcast which a simple query on outputting all fields where the ID = SelectedbordcastID. I then to my field to display the narrative of my selected row in my textarea field.
The second paramater I do the following with.
$SelectedRowID = 0;
if( isset($_GET['RowNumber'])) {
$SelectedRowID = $_GET['RowNumber'];
}
Above I placed just after code covering my two queries.
4: Then finally to get the datatable to select the row of the selected row I include the following to the var yuidatdatable section of the datatable script...
yuidatatable1.select(yuidatatable1.getRow());
The -1 value referred to step 2 serves as a work around to fact that yuidatatable works on a 0 base and the MySQL referred to in step 1 on a 1 base.
There you go !
Perhaps there is a better why using get from within YUIDatatable scripting, be nice to know if so. That said this work fine for me and perhaps if you have not found an answer I hope this helps.