Title: Error when Read Datagrid data from MS SQL Server for Cell Editing in DataGrid Post by: ozzy on June 22, 2015, 10:34:26 AM Hello all,
I have a small problem and was not able to find a solution for it. I have to make a mvc Webapplication using a datagrid to present some feeds read from Social Neworks. I am using a slightly modified variant of the Cell Editing in DataGrid http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=Cell%20Editing%20in%20DataGrid (http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=Cell%20Editing%20in%20DataGrid). The difference are that I am reading the data from a database (MS SQL Server) and not statically from a json and I use one text editor field and a combobox with some values and modified formatters. Reading the data from database is OK and the table is populated correctly. The only thing is that when entering a text input cell or the combobox the value therein is getting some blanks before and after and the value is not recognized correctly "0" becomes " 0 ". See the attached pics. In the combobox formatter I was able to fix it by trimmimg the blanks (see below String(value).trim())) but I am not able to do it then DataGrid cell is set for editing. Also the combobox seems to have a fixed height so it doesn't adjust dinamically after the number of elements in the dropdown list. I tried for several days now to find a solution but no luck at all. Does anybody had similar problems or does anyone know how to trim the DG cell content when the cell is in edit mode and where can I set the combobox to adjust depending on the number of elements? Here is how I construct the DG with the js section in the index.cshtml... Code: <div id="FeedLinksDiv" style="margin:20px 0"></div> Title: Re: Error when Read Datagrid data from MS SQL Server for Cell Editing in DataGrid Post by: stworthy on June 22, 2015, 06:29:42 PM The datagrid data can be retrieved from remote server or the local existing <tr> elements. If you are transforming datagrid from an existing, unformatted html table, make sure that you don't render unwanted space before and after nested <td> element. The code may look like this:
Code: <tr> Or override the $.fn.datagrid.parseData function to change the default parsing behavior. Code: <script type="text/javascript"> Title: Re: Error when Read Datagrid data from MS SQL Server for Cell Editing in DataGrid Post by: ozzy on June 23, 2015, 09:54:39 AM It works like a dream now, by overriding the pars function!!!!!
I guess I was too preocupied studying the js scripts and trying to understand all that then to see the obvious. Do you also figure it out why the combobox have a fixed height and it doesn't adjust dinamically after the number of elements in the dropdown list? (see pic Combo_after_height.jpg above) Thank you and regards, Ozzy Title: Re: Error when Read Datagrid data from MS SQL Server for Cell Editing in DataGrid Post by: stworthy on June 23, 2015, 06:12:00 PM By default, the drop-down panel has a fixed height. You can set the 'panelHeight' property to change its height.
Code: editor:{ Title: Re: Error when Read Datagrid data from MS SQL Server for Cell Editing in DataGrid Post by: ozzy on June 26, 2015, 12:38:44 PM That did it! All my problems are solved now!
Yoe are vgreat man! I would like to know how can I make it even! Any idea? Regards ozzy |