We have a view delegate and we are returning custom results according to the filters specified. Once the result is available the user choose any record, say 3rd and uses it. Next time they might change the filter criteria, and the view delegate returns a different set of result.
Here it seems the grid is auto selecting the record in previous position (3).
how can i reset the selection to the first record?
<View>.Current = <FirstRecordINeed>;
<View>.Cache.ActiveRow = <FirstRecordINeed>;
I have tried setting the activeRow/current in view delegate and the filter row updated event. But doesnt work. Any help?
To get ability to affect grid's ActiveRow you should specify property SyncPositionWithGraph="true" in the px:PXGrid in aspx.
After that you can set <View>.Cache.ActiveRow in the view delegate and it will affect grid.
Related
How to add an input field on processing page grid column.
There is option to add Type in PXGridColumn property but it does not have any value for text box and then the column result as readonly on UI,
Where as the added column should take the input,
Example - Need to process all the Production Order and set its status
Put the field you want to set on the header instead of the detail lines, and then set all the status' based on the header value. Like Hugues said, the entire grid is probably disabled for a reason.
Is there a way to hide an entire row, not just a single column, in a grid? I'm tried PXUIField.SetVisible, PXUIField.SetVisibility, PXUISetVisible, and PXUISetVisibility, but none of them seem to work. I know that using PXUIField.SetEnabled(cache, row, false) disabled the entire row, but can I make an entire row invisible?
You need to make sure the row is not returned in the query (could override the view delegate and not return specific rows) or removed from the cache. I don't think there is anything that can hide a row using the UI related calls, but I have never come across the need for this to ever try it.
The usual pattern is to use a PXFilter DataView current DAC record to filter the PXSelect DataView bound to the grid.
The filter fields are often changed on screen directly by the user but you can also set the value of the current filter DAC record programmatically in event handlers to build more complex logic.
public PXFilter<DACFilter> Filter;
public PXSelect<DAC,
Where<DACFilter.field, Equal<Current<DACFilter.fieldFilter>>>> GridDataView;
I am looking for a way to set a list field default value to a property that I have programmatically set on the site where the list resides.
Essentially every item in the list will have the same value which will be hidden from the normal user view. Down stream, I am using a content query web part to pull that field so I can group on it.
I am using SP2013.
Thanks for the help
With Site Properties you mean the SPSite.RootWeb.AllProperties property bag which you have filled with some custom property?
Assuming that is what you are talking about, there are unfortunately no standard ways to work with property bags - besides programming that is.
You said you want to set a default value on a list field for each list item. This sounds like an event receiver! You can choose to have it fire on item updating and/or item created for all your items and always set the hidden field on the item with the value from the site properties.
I'm having this categorized view displayed in a view panel where the category column itself is not shown. Instead I'm displaying a combobox above the viewPanel where users can select from all the categories available (see screenshot below). The combo is bound to a scopeVariable and is refreshing the viewPanel onChange. The viewPanel has a computed categoryFilter reading from the same scopeVar. That all works nicely.
Now I also have implemented an additional wildcard (*) value in the selection list which (if selected) programmatically sets the cat filter to NULL. This way I'm forcing the viewPanel to show all entries. Again, this works fine, but with the drawback that now the view is showing empty rows where the category entries would be shown normally (in the screenshot you see empty rows above each entry, with 2 entries for the category "edcom GmbH" obviously belonging to the same category; those aren't separated by an empty row):
One way to at least hide those empty rows would be through means of css coding. But I would prefer those rows not being rendered at all.
Can this be done at all using a viewPanel, and how? Or do I have to use other controls like a repeat or a dataTable maybe?
Thanks in advance,
Lothar
One "hack" (an ugly one I admit) would be to change your categorization column from Firma to Firma:"--All--" or Firma:"*" and then instead of setting the category filter to NULL you set it to "--All--" (or "*").
The double category hits the indexer, but should do what you need.
Obviously there's no easy way. So meanwhile I'll stick to this css-style solution:
In the view panel und All Properties - data I set var = "entry". Then, under All Properties - styling I set a programatic value for the rowClasses property:
if(entry.isCategory()){
return "rowStyleHidden";
}
return "";
The style class "rowStyleHidden" hides those rows using
display: none;
Don't know yet how this turns out performance-wise, I'll have to observe this once I implement it in a copy of the real database.
You can also switch to a none categorized view, by having the viewname calculated based on the value in combobox.
It seems there have been a few questions here regarding this subject, and they have some great answers, but it seems that my case is a little different. I need to filter the records displayed in a jqGrid, but entirely client-side.
For a number of reasons, the best way for me to populate my grid is with an array that's emitted directly into the JavaScript on the page. The grid itself doesn't interact with the server at all. I have some custom AJAX happening in various grid events, but that's it. (Basically, I'm integrating this with an existing set of available services which can't change significantly.)
What I'm looking to do is filter the grid based on a simple text input and button. My page has the text input, the button, and a table (which becomes the grid on document ready). I'd like to bind to the click event of the button (normal jQuery event binding, nothing special) and use the value from the text input as a display filter on the jqGrid.
By "filter" I mean to display only the records which contain a match (in any field) for the text in the input. Then, to display all records, just empty the input and click the button again. Additionally, the grid is multi-select and the selections need to persist through filtering. I just need to be able to hide the rows which don't match what's in the input.
Is this possible?
To filter local grid you should only fill filters property of the postData parameter of jqGrid and set additionally search:true.
To save selection of the grid you can use reloadGrid with additional parameter [{page:1,current:true}] (see here).
The corresponding code can be the following
$("#search").click(function() {
var searchFiler = $("#filter").val(), grid = $("#list"), f;
if (searchFiler.length === 0) {
grid[0].p.search = false;
$.extend(grid[0].p.postData,{filters:""});
}
f = {groupOp:"OR",rules:[]};
f.rules.push({field:"name",op:"cn",data:searchFiler});
f.rules.push({field:"note",op:"cn",data:searchFiler});
grid[0].p.search = true;
$.extend(grid[0].p.postData,{filters:JSON.stringify(f)});
grid.trigger("reloadGrid",[{page:1,current:true}]);
});
I made the demo for you which filter for two columns 'Client' ('name') and 'Notes' ('note') you can extend the code to search in all columns which you need.
Depend on what you exactly mean with the saving row selection you can need to save the current selection from the selarrrow in a variable and restore the selected rows with respect of setSelection method.