GithubHelp home page GithubHelp logo

Comments (6)

jobinnthomas avatar jobinnthomas commented on June 1, 2024 2

Hi @jobinnthomas, in your requirements.txt you are using ipydatagrid==1.1.15

Try updating to the latest release 1.2.1 where I resolved the issue of column widths resetting when setting new data if auto_fit_columns is set to True.

Here is the PR fixing that issue: #452

Thanks..Yes i can confirm the issue is fixed..I am using the following and it works. You can close the issue.
notebook==7.0.8
voila==0.5.5
ipywidgets==8.1.1
ipydatagrid==1.2.1
ipynb==0.5.1

reqAcq.txt

from ipydatagrid.

jgunstone avatar jgunstone commented on June 1, 2024 1

hi -
if you set data in the way that you have, i.e.:
mygrid.data = df_new
you are effectively reinitialising the grid - you could give it a whole new dataframe with different col names when doing this.
as such it doesn't resets behaviour you had previously applied.
you can either:

  • record the col widths before you set the grid and then reset them after (probs easiest)
  • use the set_cell_value method to set the values of the cells you want to change. this is probably the "cleanest" method as it just updates the data in-place without re-initialising the whole grid.

from ipydatagrid.

ollyhensby avatar ollyhensby commented on June 1, 2024 1

Hi @jobinnthomas, in your requirements.txt you are using ipydatagrid==1.1.15

Try updating to the latest release 1.2.1 where I resolved the issue of column widths resetting when setting new data if auto_fit_columns is set to True.

Here is the PR fixing that issue: #452

from ipydatagrid.

jobinnthomas avatar jobinnthomas commented on June 1, 2024

hi - if you set data in the way that you have, i.e.: mygrid.data = df_new you are effectively reinitialising the grid - you could give it a whole new dataframe with different col names when doing this. as such it doesn't resets behaviour you had previously applied. you can either:

  • record the col widths before you set the grid and then reset them after (probs easiest)
  • use the set_cell_value method to set the values of the cells you want to change. this is probably the "cleanest" method as it just updates the data in-place without re-initialising the whole grid.

Thanks for the suggestions.

  • use the set_cell_value method to set the values of the cells you want to change. this is probably the "cleanest" method as it just updates the data in-place without re-initialising the whole grid.

    • I do know the number of rows before hands...So maybe I could create the Datagrid with the known number of rows, all
      blank and then resize the height of the datgrid to avoid showing them even. Then i could set the cells one by one.
  • record the col widths before you set the grid and then reset them after (probs easiest)

    • This does not work............for whatever reason.

from ipydatagrid.

jgunstone avatar jgunstone commented on June 1, 2024

just checked this -
it doesn't look like it resets the col widths if the dataframe is the same

ipydatagrid

import pandas as pd
import ipydatagrid as DataGrid

df = pd.DataFrame({"a": [1,2], "b": [3,4]})
df1 = pd.DataFrame({"a": [3,4], "b": [5,6]})
gr = DataGrid(df, column_widths = {"a": 20})
gr
gr.data = df1

from ipydatagrid.

jobinnthomas avatar jobinnthomas commented on June 1, 2024

Try the example I provided.......Do you see what I see? Run it 15 times and see if the output changes.
If you don't, can you provide me your requirements file.....

from ipydatagrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.