Session timeout , responsive profiles, datagrid sorting bug

0
0

Hi, I have 2 questions and a possible bug report:

  1. Where can I find the definitions for predefined responsive profiles? For example, what does “Small Desktop” means? Can I modify predefined profiles? Can I add new ones? If yes, haw can be deployed?
  2. Session timeout. I can set it (ok), but… if you change browser tab and let it for 2 hours, when you came back to wisej application it offers to extend session?! After 2 hours? Maybe I don’t get the concept.
  3. Big bug on datagridview.
    1. Fill the datagridview (doesn’t matter how)
    2. make some lines visible=false (some local search…)
    3. try to sort by clicking a column header. The lines now are totally different (like the grid is re-sorted and the “visible” attribute is applied to the old row indexes!

Thank you,

Adrian

  • You must to post comments
0
0
  • Adrian Zagar
    Thank you. I’ll study the project. The videos are both 7 seconds length and white.
  • You must to post comments
0
0

And forgot to add then when using a DataTable you can use the built in RowFilter property and don’t have to search all rows in your code. In this case the sorting doesn’t need any patch since the data source manages the hidden rows. Try this:

string what2search = "%email%";
var dataTable = (DataTable)this.dg.DataSource;
dataTable.DefaultView.RowFilter = $"NUME LIKE '{what2search}' OR VALOARE LIKE '{what2search}' OR DESCRIERE LIKE '{what2search}'";

As a reference also look at:

https://www.csharp-examples.net/dataview-rowfilter/

  • Adrian Zagar
    I have some sort of… personal framework and I have a generic search feature, that’s why I search all rows/columns. What I sent you is a stripped version for testing. But I did something starting from your idea: on Sorted event I did the search again. It’s not very elegant, but it did the job. Thank you! Could you send me the project with ClientProfiles.json working? :)
  • Luca (ITG)
    You can use Fill() instead of assigning the DataSource, It creates the rows from the datasource, In that case the rows are not data bound and you can hide them in the DGV instead of the DataTable.
  • You must to post comments
0
0

The sorting bug is a bit different than what I thought. When the sorting is done by the data source the visible state is reset because the rows are not managed by the DataGridView. You can try the same in the DataGridView in WinForms. Cannot do it in WPF since the DataGrid doesn’t support hidden rows.

This is a workaround until the next build where Wisej.Web.DataGridView will refresh all the rows and the sorting is done by the data source.

private void dg_Sorted(object sender, EventArgs e)
{
   Application.Post(() =>
   {
     this.dg.Refresh();
    });
}

It’s not necessary when the rows than change position are less then 16 which is an internal threshold that optimizes the grid updates by only changing the affected cells or rows instead of reloading the current page.

 

  • Adrian Zagar
    It’s not working. Adding your code to Sorted event I loose the searching results (I mean all rows are displayed). Can you please put that in the test project and send it if it’s working? Maybe I did something wrong.
  • Luca (ITG)
    As I wrote this is the correct behavior because you are hiding the rows in the DGV and not in the DataSource and the sorting is managed by the DataSource. See the reference links I sent. Sorting reloads the data source, hence the hidden flag in the DGV rows is obviously also reset.
  • You must to post comments
0
0

Regarding ClientProfiles.json, I tried to use this one:

{
“profiles”: [
{
“name”: “Test”,
“maxWidth”: 2025
}
]
}

I set 2025 to be sure it’s more than my fhd display on pc. I modified the size and position of 1 textbox and 1 button on designer (default profile and Test profile). On runtime it display the default size/positions.

The ClientProfiles.json is copied on bin directory.

What am I doing wrong?

PS I’m using 2.2.14 version.

 

 

  • Luca (ITG)
    Send a test case. I just tried with Test: maxWidth: 2025 and worked well.
  • You must to post comments
0
0

Hi Luca,

Here you have a project to reproduce the sorting problem.

  1. load data (must put exportData.txt file in c:\temp or change the location)
  2. push search (will remains just rows with “email” on them.
  3. sort using column header (first column) and you’ll see very different lines 🙂

Thank you for helping,

Adrian

  • Luca (ITG)
    Thank you. Looks like an old bug when the sorting is done the DataTable and not Wisej. Will log.
  • You must to post comments
0
0

Cannot reproduce the hidden rows issue.

Tried this with 2.2.14. Sorting with the hidden rows preserves the correct hidden rows and when making them visible again they are in the correct sorted position.

 var bs = new List<Person>();
 this.dataGridView1.Columns.Clear();
 this.dataGridView1.AutoGenerateColumns = true;
 bs.AddRange(new Person[] {
 new Person{Name="A"},
 new Person{Name="B"},
 new Person{Name="C"},
 new Person{Name="D"},
 new Person{Name="E"},
 new Person{Name="F"},
 new Person{Name="G"},
 new Person{Name="H"},
 new Person{Name="I"},
 new Person{Name="J"},
 new Person{Name="K"},
 new Person{Name="L"},
 });
 this.dataGridView1.DataSource = bs;
 this.dataGridView1.Rows[1].Visible = false;
 this.dataGridView1.Rows[3].Visible = false;

 

  • You must to post comments
0
0

Responsive profile are configurable in the ClientProfiles.js file. Click Add -> New Item -> Wisej 2 and pick Client Profiles. It will add ClientProfiles.js to the project with the default entries. You can delete, add, change them.

The SessionTimeout set in Default.json is the timeout until the SessionTimeout event is fired (https://wisej.com/docs/2.2/html/Configuration.htm) which gives your app a chance to inform the user (built-in) or do anything else by handling the SessionTimeout event. By default the session is destroyed timeout * 2 when the tab is closed. If the user is starting at the browser the session will stay alive. Switching tabs in a browser doesn’t make the session invalid.

You can change the behavior however you need it by handling Application.SessionTimeout and/or Application.BrowserTabActivated and BrowserTabDeactivated events.

The DGV sorting problem does indeed looks like a regression since 2.2 implemented virtual rows.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.