Sunday, 15 September 2013

javascript - Use jQuery plugin tablesorter in Yii view -


I try to include Yii view in the jQuery plugin "I do not like page refreshes in a sortable table and for turning a standard HTML table with the tbody tag".

I know that CGridView will have a more elegant version to do this in Yii, but in order to get the jQuery plugin to work primarily interested, so far the table is not sorted , Although other jQuery functions (like a pop-up window or toggle button) work.

Any thoughts that I am doing wrong? This is my idea:

  & lt; Php Yii :: app () - & gt; ClientScript- & gt; RegisterCorScript ('http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'); Yii :: app () - & gt; Classic Script- & gt; Click the 'Register' button ('Buttile', '$' ('button'). (Function () {$ ('p'). SlideToggle ();}); ", CClientScript :: POS_READY); Yii :: app ) - & gt; clientcript-> RegisterScriptFile ('/ jquery.tablesorter.js'); Yii :: Application () -> clientScript-> RegisterScript ('tablescript', "$ (document) .ready (Function () {$ ('# myTable1') tablesorter () ;.}); ", CClientScript:: POS_READY);? & Gt; & lt ;? php echo" & lt; P id = 'paragraph 1' & gt; This is a paragraph. & Lt; / P & gt; "; echo" & lt; Button ID = 'Button 1' & gt; Toggle between slides and slide down for the P element & lt; / Button & gt; "echo" & lt; Table id = 'myTable1' class = 'tableorter' & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th & gt; Last name & lt; / Th & gt; & Lt; Th & gt; First name & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; TD & gt; Smith & lt; / TD & gt; & Lt; TD & gt; John & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Jones & lt; / TD & gt; & Lt; TD & gt; Martha & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Noble & lt; / TD & gt; & Lt; TD & gt; Donna & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Smith & LT; / TD & gt; & Lt; Td> Mikey & lt; / Td> & Lt; / Tr & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; ";; & Gt;  

Edit: The path should be a problem. When I directly hotlink to jquery.tablesorter.js, it works fine. Can be switched off.


No comments:

Post a Comment