Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
This topic is locked No permission to create posts
sp_Feed Topic RSS sp_TopicIcon
Re-order columns
13/09/2009
05:29
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello Mark,

Yes you are right. I will make a 3.5 branch next week.

About the new method – great work. Work ok and look very impressive.

As usual some notes:

1. the recalculation of width when reorder does not work for me

I have changed

“done” : function(perm) { if (perm) self.jqGrid(”remapColumns”, perm); },

to

“done” : function(perm) { if (perm) self.jqGrid(”remapColumns”, perm,true,false); },

and it seems to work ok.

2. Another note (UI Dialog is not my love ;) )

When we call the dialog many times there is a unneeded contet in the DOM (as first child of body)

I think this is not needed and have added

        var dopts = {
            “buttons”: buttons,
            “close”: function() {
                select.multiselect('destroy');
                $(this).dialog(”destroy”);
                if (opts.done) {
                    opts.done.call(self, null);
                    $(this).remove();
                }
            },
            “resizable”: false,
            “width”: opts.width+20
        };

which deletes the content after the dialog is closed.

3. The dialog should be compatible with the language file.I think I will do this.

ui.multiselect.js uses his own localization so I will not care about this.

4. I think that adding another option shrikToFit or similar where the grid can be resized zo that it fits the width after show/hide will be great. I will try to fix the setGridWidth method – it is a little buggy when goes to recalculation of columns.

Thanks again

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

13/09/2009
11:00
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Hi Tony,

Fixes look good (in my grid I was overriding the "done" method, so didnt notice the missing "true").

I've just noticed there's a problem with the earlier changes. If you set viewsortcols[2]== true, clicking on the sort icons doesnt cause a sort.

I /think/ its a jquery bug: In the "click" method for the th elements, $(e.target).closest("th>div>span.ui-grid-ico-sort") doesnt find the span. But either $(e.target).closest("th>div>span") or $(e.target).closest("span.ui-grid-ico-sort") does find it (this is FF3.5 - Ive not tried anything else yet).

Also, even if I use the latter, it always sorts ascending. I need to investigate some more, but thought I would give you a heads up.

Mark

13/09/2009
23:08
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Hi Tony,

I fixed the problem with viewsortcols (it was my bug, not a jquery problem!).

I've fixed columnChooser issues you mentioned.

I also agree with you about not foisting dialog onto everybody, so I've made it much more configurable. You can now specify the multiselect widget, and the dialog widget, together with their options.

If opts.dlog is a string, and names an available widget, it will be invoked to create/destroy the dialog object, and gets passed opts.dlog_opts as its options. If its a function, it gets invoked the same way that a widget would be (ie this is the jquery element, and its argument is either an options object, or the string "destroy").

If opts.dlog_opts is a function, it gets invoked with the grid object as "this", and the opts object as its argument. The opts object has had a couple of useful methods added to it: apply_perm, and cleanup. You just need to call apply_perm and cleanup(false) from your "ok" button, and cleanup(true) from your cancel. Or you can do the cleanup yourself...

Similarly for opts.msel and opts.msel_opts.

In most cases, dlog_opts will need to be a function (so it can dynamically configure the options for dlog) but msel_opts will be an object literal (or null if no options are required, as is the case for multiselect).

The default is still dialog and multiselect. If I could figure out how to use jqModal, Id write an example for that 🙂

Mark

14/09/2009
09:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello Mark,

One more bug that I found.

            if (this.name == "cb" || this.name == "rn" || this.name == "subgrid") {
                fixedCols.push(i);
                return;
            }
            if (this.hidedlg) return;

I think that this can be replaced with more simple code

            if (this.hidedlg) {
                fixedCols.push(i);
                return;
            }

To reproduce:

Set on first column hidedlg:true

Then activivate the dialog and just click OK.

The column moves to the last.

These  this.name == "cb" || this.name == "rn" || this.name == "subgrid"

have always hidedlg to true when they are initialized.

Tonight I will test your new code

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

14/09/2009
10:29
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Hi Tony,

I see... I had misunderstood hidedlg. I had assumed that hidedlg implied hidden (although now, I see that it obviously doesnt).

So I think the correct test is:

if (this.hidedlg && !this.hidden) {

   fixedCols.push();

   return;

}

Mark

14/09/2009
15:10
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Make that:

if (this.hidedlg) {

  if (!this.hidden) {

    fixedCols.push(i);

  }

  return;

}

Mark

14/09/2009
23:25
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Mark,

Everthing work ok (for me) with the last changes.

Currently I have a problems with a GitHub. I will merge the changes if I have chance to do this and will create a new branch.

(Just to know - the multiselect widget have problems with Opera. To reproduce - call columnChooser in Opera and then try to move the last visible column to some place - the entry list is broken (Opera 10 in Windows XP).

I just thested this on the author site and it is broken - will make a post for this)

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

16/09/2009
23:17
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Just found one more issue with the column re-ordering.

If the index is specified via "jsonreader.ix = 0", and repeatitems is true, for example, and you move column zero, it no longer works.

I see how to fix it - I'll try to get it committed tomorrow.

Mark

17/09/2009
18:22
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Sorry, user error. The code was fine.

Mark

18/09/2009
03:40
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello Mark,

Glad to hear that all is OK.

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

20/09/2009
08:20
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Mark,

Found a bug in columnChooser. Short: the hidden coulms should be appened at end of the select. Otherwise there is a unexpected result when we try to show a column, which is at end of multi select list (whitout reordering) , but it is displayed at first place.

The fix is in GitHub

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

20/09/2009
08:36
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Again me,

This is not correct fix. The correct fix should be in multiselect plugin - i.e when we add a new visible column (whitout reordering) the select list should be updated.

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

20/09/2009
12:44
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

And again,

I confirm that there is a bug in columnChooser when repeatitems:false and id is number which represent the row which shoud contain the id. Will see tomorrow how to fix this.

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

20/09/2009
23:27
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Hi Tony,

Re: ui.multiselect. Yes, there's a bug. It looks like there is an "experimental" version in github which has fixed this, but also introduces dependencies on a couple of new plugins.

Re: repeatitems false. I think I do see /a/ problem - if the xml reader has its index specified by ts.p.xmlReader.id, then it tries to look it up by name, even if the index is numeric; but Im pretty sure I didnt change that behavior (ie its nothing to do with column reordering).

I did find a bug in addXMLData that I introduced for the repeatitems true case: if the server doesnt return all the columns (ie, it just returns the first few), then it errors out. The fix is in gitHub.

Mark

21/09/2009
06:13
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Mark,

To reproduce:

1. Set in colModel the property for some column key:true. If the column is hidden and is first all is ok, but the problem appear when it is visible.

2. Json reader repeatitems : true or reapeatitems:false  and the id is set as number – something like

jsonReader : {repeatitems: true(false), id:”0″}, where id :”0″, point to the first column.

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

21/09/2009
09:27
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Tony,

Im having trouble reproducing the problem - Im not even sure what the problem is.

One thing to note is that the id in the json reader (or xml reader) is not used when you set "key":true on a column (setting key takes priority), so your step 2 does nothing - unless that's the bug you're referring to? But in that case, its not related to the column reordering...

Mark

21/09/2009
09:30
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

The problem appear if you ask for the id - getGridParam('selrow')

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

21/09/2009
09:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Life example

Here is the config:

        datatype : 'json',
        jsonReader :{repeatitems:false,id:”0″},
        colModel : [
            {label: 'Id', name: 'invid', hidden:true, width:1, search:false, hidedlg: true},
            {label: 'No Фактура', name:'invno', index:'invno', width: 60, hidedlg:true},
            {label: 'Дата', name:'invdate', index:'invdate', width:60, formatter: 'date', searchoptions:{dataInit:function(el){$(el).datepicker();}}},
            {label: 'Срок Пл.', name:'paydate', index:'paydate', hidden: true, width:60, formatter: 'date', searchoptions:{dataInit:function(el){$(el).datepicker();}}},           
            {label: 'Кл.No', name:'clientid', index:'invoice.clientid', width: 50, hidden:true, searchoptions:{searchhidden:true}},
            {label: 'Клиент', name:'cname', index:'clients.cname', width: 120},
            {label: 'Документ', name:'docid', index:'invoice.docid', width: 1, hidedlg:true, hidden: true, searchoptions:{searchhidden:true} },
            {label: 'Документ', name:'docname', index:'doctype.docname', width: 120,search:false},
            {label: 'Сума', name:'amount', index:'amount', width: 70, align:'right', formatter:'number', searchoptions:{sopt:['eq','ne','gt','ge','lt','le']}},
            {label: 'Общо',  name:'total' , index:'total', width: 70, align:'right', formatter:'number', searchoptions:{sopt:['eq','ne','gt','ge','lt','le']}},
            {label: 'Платена',  name:'pay_amount' , index:'pay_amount', width: 70, align:'right', formatter:'number', searchoptions:{sopt:['eq','ne','gt','ge','lt','le']}},
            {label: 'Анул.', name:'anulate', index:'anulate', width: 30, formatter:'select', editoptions:{value:{1:'Да',0:'Не'}},stype:'select', searchoptions:{sopt:['eq']}},
            {label: 'Тов.', name:'bill_included', index:'anulate', hidden:true, width: 30, formatter:'select', editoptions:{value:{1:'Да',0:'Не'}},stype:'select', searchoptions:{sopt:['eq']}}
        ],

After reordering I get wrong id

Sorry for edit.

I mean after pagging the coulmns are ok, but the id is wrong

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

21/09/2009
09:40
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Yes the problem is not in the reordering, but in orderedCols function which does not care about the id. Will try to explain it in example.

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

21/09/2009
09:40
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Yes the problem is not in the reordering, but in orderedCols function which does not care about the id. Will try to explain it in example.

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

This topic is locked No permission to create posts
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
29 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information